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

Deleting the records in the table and importing a text file

Status
Not open for further replies.
Sep 21, 2001
28
US
I wonder is there a way to delete all the data in the table and then import a text file into that same table without having to use the wizard. The reason I need to do this is because the records in the table always change, and I receive a new text file every week to import into that same table. I am a somewhat a beginner programmer, so if possible, please give detailed instructions.

Thanks
 
Yes, I do this all the time.

docmd.runsql("Delete * from table1")
DoCmd.TransferText acImportDelim, , "Table1", FileName, False


Take a look at Access's help file for the transfertext arguments. If your text file has headers then make sure those headers match the field names in your table.
Maq B-)
<insert witty signature here>
 
Hi just an idea, maybe you what to try something like create a True/False Field to know if the records were changed by users so you can use a Update or a Append query and replace or add to a new Table that records. Best Regards

---
JoaoTL
NOSPAM_mail@jtl.co.pt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top