Import from another database

Rattlesnake

Registered User.
Local time
Today, 07:13
Joined
Sep 19, 2002
Messages
31
hi,
I am using Access 2000.
I want to know the SQL query to import data from another Access database. i.e. Copy the records from a table in another database into the Access database that I am currently working in.
Basically the main database(from where I will import) will be updating everyday and at the end of the month I want to run the above query to import the records that were added in the previous month to my current database.(So actually it is not importing all records but only the records that are not present in my current database.)
Both databases are on the network.

Thanks


__________________
 
Hey Rattlesnake,

Here was my first thought - you can write a "make table" query (in the db that has the data you need) to create a table in another database.

Next, use the code like this (in the other db) to open the target db and run the make table query.

Private Sub GetTable()
Dim dbs As Database
Set dbs = OpenDatabase("c:\yourtargetdb.mdb")
On Error Resume Next
'not sure about this next line - but it should be close
dbs.DoCmd.OpenQuery ("your_make_table_query")
dbs.Close
Set dbs = Nothing
End Sub

I don't have Access here, so I can't verify anything - but I have done this! Let us know how you make out and on Monday I can post tested code if you still need it.

Good Luck!

-Sean
PS (thanks to Tim K. for most of the code)
 
Last edited:

Users who are viewing this thread

Back
Top Bottom