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!

transfering data from one database to another

Status
Not open for further replies.

balllian

MIS
Jan 26, 2005
150
GB
Im using the 'transferdatabase' within in a macro to move data from one database to another. Is there a way that i dont delete existing data off the destination table as the new data needs to added to existing information rather than replace everything.

Thanks in advance
 
First off I wouldn't use 'macros' at all.
VBA offers far more flexibility.


If the target ( destination ) database and tables exist already then I wouldn't use Transferdatabase.

I'd simply use

DoCmd.RunSQL "INSERT INTO tblTargetStatus ( StatusId, Status ) " _
& "IN 'C:\Files\Databases\Target.mdb' " _
& "SELECT StatusId, Status " _
& "FROM tblStatus;



( Replace files, table and field names as appropriate )


'ope-that-'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
The macro i have developed does a number of things for me when the database starts up.

1. Imports the a text file into the database
2. Runs five update queries on the imported information
3. Exports the updated data to another table
4. Runs a delete query to get rid of that imported info
5. Closes it self down

Would it be possible then to refer to code you provided at stage 3 rather than use the transferdatabase? Or would it be better to convert all the steps to code?
 
Or would it be better to convert all the steps to code
Righr click the macro name and play with the SaveAs option.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top