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

Restore an access table

Status
Not open for further replies.

jaggar

Programmer
Jan 23, 2003
21
US
I would like to create a form in which a user can click on a buttom to restore an access table from a disk (text file).
I would like the data from the disk file to overlay what is in the table. Can this be done?
 
By 'overlay' do you mean

Fill in the spaces but leave existing data intact

or

Simply replace

or

Overwrite

or

Append

??

Because each one of the above will take a markedly different approach to achieve.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Thanks, Replace or overwrite please explain the differences. I also would like to know which one would be the easiler to process.
 
jagger

This sounds like you want to import data. And you are not concerned about the old data. Is this correct?

Richard
 
By Replace I'd mean blow the old table away completely and Import the new data into a table defining the field names and types on the fly

By Overwrite I'd mean leave ll existing record in place and take records from the text file, match to existing records and write all available data to the relevant fields; if no records exist then append.


Look at DoCmd.TransferText

I think that will do what you need.



'ope-that-'elps.

G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
1. Create a link to the text file on disk (table A).
2. Delete all records from the database table (table B).
3. Import (append) records from table A to table B.

However, before you run any code that deletes all records from your table, you should take some precautions. For example, what will you do if the text file is damaged and you've all ready deleted everything from table B?

I would make a backup copy of table B first. Then, if necessary, you can restore the data from the backup copy to table B.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top