Full Version: ExportDelim gets error message with "#txt" instead of ".txt"
UtterAccess Discussion Forums > Microsoft® Access > Access Automation
pflute4
I am getting the Run-time error '3011' with the message, "The Microsoft Jet database engine could not find the
object 'filename#txt'. Make sure the object exists and that you spell its name and the path name correctly." I've
tried lots of things, including Chr(46) to force the use of ".", but I still get the same message.

Here is the code I'm using:

CODE
'Export table MI to Unicode text file.DoCmd.TransferText acExportDelim, _
"Export Specification", fnStr, "P:\text files\" & fnStr & ".txt", True, , 1200


Thanks in advance.
freakazeud
Hi,
what's in 'fnStr'?
HTH
Good luck
pflute4
Earlier in my code, I have the user select a file to open from a dialog, and then I crop the
file path and name to create a specific-length variable for the naming convention I want in
The ExportDelim command. The code is:
CODE
          For Each varFile In .SelectedItems
                'Truncate the file path to just the part number selected.
                fnString = Right(varFile, 11)
                fnStr = Left(fnString, 7)

I also use the value of fnStr to link the dBase table to my Access database. I am effectively linking dbase data and converting it to a unicode text format for another program.

pflute4
freakazeud
So 'fnStr' holds 7 numbers? Can you give a sample?
HTH
Good luck
pflute4
AB12345
freakazeud
So you are exporting to:

"P:\text files\AB12345.txt"

from table 'AB12345'?
Have you tried to export to the full UNC path, rather then the mapped drive letter? That letter might be totally different to your users and it is always better to use the unc path.
HTH
Good luck
pflute4
By UNC path, you mean the server? OK, I tried that, and I'm still getting the same error.

pflute4
freakazeud
Are you sure the full UNC path is correct.
Check this article for some more.
HTH
Good luck
pflute4
Using the instructions from the article you sent me to (very informative, by the way),
I confirmed that I have entered the currect full UNC path.
freakazeud
Mhhh...it should work then...have you tried to manually export to the exact same location using the exact same filename?
Do you have read/write access to the directory?
HTH
Good luck
pflute4
Yes, I just tested it again. I had previously created a macro to do the export alone,
and I just changed the File Name property to export to the UNC path and the file name I want:

\\<server>\sys2\pub\text files\AB12345.txt

The text file I wanted is there and I got no errors.

FYI, since my original code kept turning up the error that showed "#" instead of ".", I tried this alternate code:
CODE
                'Export table MI to Unicode text file.
                DoCmd.TransferText acExportDelim, "Export Specification", fnStr, _
                "P:\text files\" & fnStr & Chr(46) & "txt", True, , 1200


...with the Chr(46) to generate the proper ".", but I still got the same error.

pflute4
freakazeud
So a macro works, but the vba doesn't?
Have you tried to convert the macro to VBA and compared the two statements you will have?
Do you have an export specification named 'Export Specification'?
HTH
Good luck
pflute4
That's it! Converting that macro to VBA and comparing the 2 codes helped me find my error.
I was pointing to the wrong table to pull data from for the export. So when I had this:
CODE
'Export table MI to Unicode text file.DoCmd.TransferText acExportDelim, _
"Export Specification", fnStr, "P:\text files\" & fnStr & ".txt", True, , 1200

I should have had this:
CODE
'Export table MI to Unicode text file.DoCmd.TransferText acExportDelim, _
"Export Specification", "MI", "P:\text files\" & fnStr & ".txt", True, , 1200


...the difference being the table " MI ." (I obviously was overlooking my statement of
code's purpose!)

Thanks a million for your help!

pflute4
freakazeud
I was wondering how the table is named the same as the constructed string value for the filename, but you didn't respond to that question earlier, so I assumed it was possible.
Glad you got it sorted out.
Good luck on future projects!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.