Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Help with Automating VB code

Author  Topic 

jpiscit1
Posting Yak Master

130 Posts

Posted - 2004-03-25 : 15:09:03
I have some code I am looking to execute on start up of my Access database. The code enables me to run a DSN-Less connection. It requires the following input parameters:

FixConnections "MyServer", "MyDatabase"

The actual code can be found at:
http://members.rogers.com/douglas.j.steele/DSNLessLinks.html

I am not sure how I would automate this. The code is currently set up in a module. I have tested it (using the debug window and inputting these parameters) and it works nicely. I thought maybe I could use a macro or a put these parameters in the "on load" event of my opening form. But i am lost as to how I proceed. Can someone help?

Thanks

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-03-25 : 22:13:09
You can use command line parameters to run specific macro's automatically when opening an Access DB.
Or you can create a macro called 'autoexec' (I think) that will execute automatically when opening the DB.
Check the Access doco for more info.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-03-26 : 09:53:28
I am confused ... do you need this to run for a specific database, or for ANY database?

if it is just a specific one, just run it once and be done with it ... why does it have to execute every time the db is loaded? The table links don't "reset" to what they were each time the DB is closed.

If you are constantly adding linked tables to your database, then use a FILE DSN -- if you notice, the way Access uses file DSN's it just takes the definion of the file and puts it into the connect string. Then, you don't need an actual DSN installed nor do you need reference to the file. Try it out, see how it works, but I have found file DSN's is the way to go (short of manually linking the tables and entering the connection string by hand, which requires VBA at least in versions <=Access 2000).



- Jeff
Go to Top of Page
   

- Advertisement -