Importing files?

ekta

Registered User.
Local time
Yesterday, 23:28
Joined
Sep 6, 2002
Messages
160
Hi:

I have a database that converts datafiles of type .ACY into .txt and then imports them in access tables. Instead of using the import wizard I automated the task of importing . Initially,I had entered the path where the datafiles were saved on the hard drive manually...C:\Datafiles\ and that worked fine. Now to give some more flexibility I added a browse button where the user can select the directory where all the datafiles are saved. But for some reason it is not recognizing the path using the browse button. It does not import any table. I don't why this is happening. I would appreciate if anyone could help me with this. I am attaching the db and also datafiles that are imported.

Thanks,

Ekta
 

Attachments

Last edited:
ekta,

You're missing the "\" at the end of the path.

mPath = Me.ImportDirectory
mFilename1 = Dir(mPath & "\*.acy")

Wayne
 
WayneRyan said:
ekta,

You're missing the "\" at the end of the path.

mPath = Me.ImportDirectory
mFilename1 = Dir(mPath & "\*.acy")

Wayne

Thanks for replying Wayne. I added "\" but now when I click on the import button it gives Error 53 "File Not Found". I havn't changed anything in code. The only difference is that before I had manually typed in the file path and now I am using the browse button to give users more flexibility. I don't know why it is not working. I am attaching the db and datafiles in which the code is working. I really need to get this done by the end of the day. I would really appreciate your help.

Thanks,
Ekta
 

Attachments

Use a message box to verify your strings.

MsgBox "mPath = " & Me.ImportDirectory
MsgBox "mFilename1 = " & Dir(mPath & "\*.acy")

HTH
 
ghudson said:
Use a message box to verify your strings.

MsgBox "mPath = " & Me.ImportDirectory
MsgBox "mFilename1 = " & Dir(mPath & "\*.acy")

HTH
Hi Ghudson:

When I do that for mPath it shows me "C:\Datafiles" without "\" at the end and for mFileName it shows "mFileName1 = ".

It shows the exact same output in the db where the code is working except that is shows "\" at the end of mPath.

Ekta
 
Try this:

mPath = Me.ImportDirectory & "\"
mFilename1 = Dir(mPath & "*.acy")
 
I also added "\" in mPath and it works fine now:)

mPath = Me.ImportDirectory & "\"
mFilename1 = Dir(mPath & "\*.acy")

Thanks so much

Ekta
 

Users who are viewing this thread

Back
Top Bottom