Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a MS Access DB

Status
Not open for further replies.

llafretaw

MIS
Oct 2, 2001
64
GB
Hi,
I know the answer to this question may be quite simple, but I'm having difficulty opening another MS Access 97 db through VBa code.

Basically the two dbs are in the same folder and I have tried using the Opendatabase function with the name of the sec db as the parameter but it doesn't seem to actaully open it, it just allows you to open a recordset to that db.

I have looked at the Docmd command but can't find one that allows you to explicitly open another Db.

Thanks
 
Are you saying that you want to have two instance of Access running at the same time? Why? If you need to get records from one of the DB's into the other, simply creating a ADO connection will do the job nicely.

I also STRONGLY reocmmend that you dump Access 97. The programming model has changed significantly since then.

 
Thanks for your help.
I have 2 databases, db1 and db2. I need to open up db2 from db1 before it shuts itself down, as db2 will contain code to run a compact on db1. I thought using the OpenDatabase function from within db1 would actually open up db2, but it doesn't seems to work.
As for the matter of Access 97, will be upgrading shortly to 2000

Cheers.
 
In more recent version of Access, you can set the database to automatically compact itself on exit. Under Access 2002 (and I think that Access 2000 is exactly the same in this regard) go to tools->options->general and select 'compact on close'.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top