Unanswered: VBA TransferDatabase Nightmare - Please wake me! Error 3011 - File Not Found
I'm having an issue with the following piece of code. This is what it looks like:
Dim loc As String
loc = Me.cmbDriveLtr.Value & ":\directory1\directory2\" & Me.numloccode.Value
DoCmd.TransferDatabase acImport, "ODBC", "ODBC;DSN=FoxPro Files - Word;SourceDB=" & loc & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes; Collate=Machine;Null=Yes;Deleted=yes;;TABLE=gmgm", acTable, "gmgm", "gmgm", False
Strange thing here is this - if I move the file (gmgm) back into the \directory2 instead of the directory specified by me.numloccode.value, it's imported as planned - however, if the file is not in directory2, Access/VBA fails to find the file. Its almost like the system isn't seeing the "me.numloccode.value" taken from the form, but when I do a debug.print in my code, the loc variable is set correctly, and the path is existant.
Needless to say, I'm just baffled. Probably because I'm just a simple caveman. Your big computers frighten and confuse me. I have bad dreams about VBA. I don't know alot about this strange world, but I do know this: I need some serious help with this problem! Anyone have any clues? Any help is greatly aprieciated. Thanks.
Had a very quick skim over your code and the major thing that strikes me is that you have already defined that the loc is drive:directory1\directory2\Me.numloccode.Value
Hence if the file is not in directory2 it will never find the file check the variable loc to see if you are pointing in the correct location,
Thanks. I got the problem figured out. The thing didn't seem to be able to digest the entire connect string. After a quick "change up" on the syntax, it seems to work. BTW, here's what I finally came up with.