M
Mark Carlyle via AccessMonster.com
Ok I have read all the posts that give this answer
Maybe try something like:
Function import()
path = "c:\import\"
myfile = Dir(path + "*.txt", vbHidden) 'gets first txt
file in path specified
Do While myfile <> "" 'will cause to loop through all
txt files in path
DoCmd.TransferText acImportDelim, "YOUR IMPORT
SPECIFICATION NAME", "TABLE NAME", path + myfile,
0 'imports file
myfile = Dir 'grabs next txt file
Loop
End Function
This would import ALL .txt files in the directory using
your specification. Then delete the files.
I can use this for my problem except I also need to add the filename as a
field in each record in the dataset.
so if the filename was filename.csv I would need to set a field in the
imported record = to that filename.
The other bad part I need to do is to remove the .csv from the filename.
Thanks a ton for any help
Maybe try something like:
Function import()
path = "c:\import\"
myfile = Dir(path + "*.txt", vbHidden) 'gets first txt
file in path specified
Do While myfile <> "" 'will cause to loop through all
txt files in path
DoCmd.TransferText acImportDelim, "YOUR IMPORT
SPECIFICATION NAME", "TABLE NAME", path + myfile,
0 'imports file
myfile = Dir 'grabs next txt file
Loop
End Function
This would import ALL .txt files in the directory using
your specification. Then delete the files.
I can use this for my problem except I also need to add the filename as a
field in each record in the dataset.
so if the filename was filename.csv I would need to set a field in the
imported record = to that filename.
The other bad part I need to do is to remove the .csv from the filename.
Thanks a ton for any help