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

automated import - dated txt files?

Status
Not open for further replies.

maingold

Programmer
Oct 28, 2002
1
US
Each day I need to import several text files into an Access 97 database. The old data inside each table is deleted, and the new data is imported into the existing table (I don't have to do it this way though). The daily comma delimited text files have a naming convention similar to this: "dailytextfile_11022002.txt". Ideally, I would like to have in input box that asks the date of the text files I would like to import. From there, I assume that I could concatenate the date to create the names of the textfiles to import. I am not sure whether to go about this using a VBA module, or that macro tab in access. I am fairly new to VBA (only written excel macros), and Access. I am pretty sure I can work through the import code based on the searching that I have done on this website. However, I still need to know the best way to go about achieving my goal. Any help would be much appreciated. TIA!

 
Hi

You need a simple For Loop, the Dir function and docmd.transfertext

In outline

MyFile = Dir("*" & MyDate & ".txt")
Do Until MyFile = ""
DoCmd.TransferText, ...etc
Dir
Loop

Hope this helps Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top