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!

Text import problem

Status
Not open for further replies.

Netherby

Programmer
Nov 9, 2001
32
GB
I need to import data from a text file into Access but the problem I have is that the application that generates the text file saves it with a .res extension.

The code I'm using is DoCmd.TransferText acImport, , "tbl_import", "C:\zzz1.res" but I get an error message saying 'You cannot import this file'

Any help would be appreciated. Is there a way to change the .res extension to .txt using VBA?

Thanks
 
To make Access more secure (though god only knows how!), it will only let you import text files with a fixed set of file extensions.
You can either alter the registry key that lists the allowed extensions, or change the file name.
gives you instructions for both methods.

hth

Ben

----------------------------------------------
Ben O'Hara
David W. Fenton said:
We could be confused in exactly the same way, but confusion might be like Nulls, and not comparable.
 
Thanks all.

I've just managed to overcome the problem using FileCopy as follows:

FileCopy SourceFile, DestinationFile

SourceFile is my original .res file and DestinationFile is a new file with a .txt extension.
 
Alternatively you could use:

Code:
    Name <filepath here> As left(<filepath here>,len(<filepath here>)-3) & ".txt"

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top