Import Text with non-txt extentions

G

Guest

Hi, I have multiple text files I need to import each month with a non-txt
extension. The problem is I need to manually change the extension to .txt for
each file before running my import macros. Is there any way to add text
import extensions within Access so access will recognize them as text thus
avoiding this manual step?
Thanks
Bob, NY
 
G

Guest

You can rename all the files in a directory with this. You could put this
behind a command button.

Private Sub Command1_Click()
Dim strfilename As String
strfilename = Dir("c:\DirName\*.*")

Do Until strfilename = ""
Name "c:\DirName\" & strfilename As "c:\testdir\" &strfilename&".txt"
strfilename = Dir
Loop
 
J

John Nurick

If it's not convenient to rename the fiels, this article
http://support.microsoft.com/?id=304206 shows how to change the
extensions that Access will accept. Minor changes may be needed if
you're using a version later than Access 2000.

Alternatively, this http://support.microsoft.com/?id=306144 includes
code that automatically makes a copy of the textfile with a .txt
extension and imports that. Can also be used when exporting.

On Sat, 24 Feb 2007 04:03:00 -0800, NY Bob <NY
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top