Question : How do I export data from one Access 2003 database to another

I have a MS Access 2003 database that I wish to export data from. This needs to go into a temporary file prior to being imported into another database. Can anyone please tell me the code to export (I want this to work in VBA at the click of a button) and import (again at the click of a button).
The database I am exporting from contains a query with the data I wish to export - qryExport - I wish to place this in a temporary database file then import it into a separate database for manipulation. This data will then be placed back in the original database.

Hope this makes sense :-) the steps I need are as follows
1. Export the data in the query (in db1) - perhaps to a temporary database file
2. Import the data into an existing database (db2)
3. Import the data back into db1 - this will need to look up the record number and update it's fields with details stored in db2

I am happy to increase the points if someone can provide sample databases that do this. Thanx

Help is very much appreciated

Answer : How do I export data from one Access 2003 database to another

First of all, make a copy of you database in a safe place.
Now. The next stage is . after you make the changes, and I am assuming the table in DB2 has all the updates and you want the table in DB1 to look just like the one in DB2 for some records except the ones added after the last export. right?

If so, do the reverse by :
1 - Exporting db2 table to excel. Copy it to Computer 1, Import it to a Temp table (use the import script in DB2 and also to avoid confusion you can give the destination temp table a good name. e.g: tbl_DataForUpdate). (now it really must be a temp table for the update to work as you can't replace .

2 - After that, you will create an update query with the original table and the temp table. Create the join in the query window. (use your primary key from tbl1 and the equivalent field from tbl2 (the temp table imported from db2 excel file).

3 - Add all the fields you want to update to the QBE pane. Please do not add the one that's the primary key or any field that's an autonumber as those CAN'T be updated by this query.

4. since it's an update query, you will have at least three lines to specify in the QBE. Field (this must contain the destination field names) ; Table (this is the destination table); Update to (This must be set to the field where we are getting the value. At this point, assuming you want to update field txtCategogy in table 1 from tbl_DataForUpdate, the value in the Update to would be [tbl_DataForUpdate].[txtCategory].

Please refer to the example I have.

Note: When you go to create query in design view, it will initially be a select query. in order to change it to an update query go to the following menu path Query > Update Query.
plz report back when you do, and also you may really increase the points.
Ppango
 
Update query example.
Update query example.
 
Random Solutions  
 
programming4us programming4us