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

wildcards characters when importing text file

Status
Not open for further replies.

jon92

Technical User
May 30, 2001
37
GB
I am trying to import a text file that is generated by another app' the problem I have is, that the files generated are randomly named the only thing that is constant - is the file extension which is .rnd. I have tried using:

[DoCmd.TransferText acImportFixed, "myspec", "mydtbl", "e:\temp\[*].rnd"] and also:

[DoCmd.TransferText acImportFixed, "visitspec", "tblvisit", "e:\temp\*.rnd"]

but both methods generate an error

any suggestions please
 
Jon,

How about this if there is one file?

Dim MyFile As String
MyFile = Dir("e:\temp\*.md")

DoCmd.TransferText acImportFixed, "myspec", "mydtbl", MyFile


Please note that I haven't done this sort of thing myself...
Was cruising the forum taking a break from my own project.
Bob
 
Thanks Bob

I tried your suggestion and received the following error:
The action or method requires a File name argument.

I tried Myfile like so - "Myfile"

and received the following: Could not find object

Regards Jon
 
Jon,

Tested here and MyFile gets file name only - no path.

You may need to play with the syntax, but something like:

MyFile = "e:\temp\" & MyFile

before docmd should do the trick.

Good luck!
Bob
 
Use FileCopy move/rename the file to something predictable and store the files in a directory your import code can access.
 
BattleDroid42

I don't want the users to do that
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top