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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to automate openning another DB from form (Opendatabase ?)

Status
Not open for further replies.

NewProgrammer1234

Programmer
Sep 4, 2001
7
US
I am using Access2000 and I am currently using a macro to open a different database with a command button from a form. My problem is that I need to automate openning the new DB and closing the current one and a macro continues to run. I thought that Access used to have OpenDatabase and CloseDatabase VB functions??
Can anyone help me?

Also, does anyone know how to automate an append/import of tables from another database into existing tables. For example, I am using acImport but that does not append into an existing table. Any answers??
 
Have you looked at the CloseCurrentDatabase Method in Help. That could be what ur looking for.

As for the import, try using SQL in VBA and use Append, specifying the path of the other db.

Nick
 
Here is some code that may help:

Dim db As Database
Dim sSQL As String

Set db = OpenDatabase("c:\externalDatabase.mdb")
sSQL = "INSERT INTO internal SELECT * FROM external;"
db.Execute sSQL

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top