UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> ExportDelim gets error message with "#txt" instead of ".txt"    
 
   
pflute4
post Jul 24 2006, 08:31 AM
Post #1

New Member
Posts: 8
From: Illinois



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.
Go to the top of the page
 
+
freakazeud
post Jul 24 2006, 11:00 AM
Post #2

UtterAccess VIP
Posts: 31,413
From: NC, USA



Hi,
what's in 'fnStr'?
HTH
Good luck
Go to the top of the page
 
+
pflute4
post Jul 24 2006, 11:12 AM
Post #3

New Member
Posts: 8
From: Illinois



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
Go to the top of the page
 
+
freakazeud
post Jul 24 2006, 11:14 AM
Post #4

UtterAccess VIP
Posts: 31,413
From: NC, USA



So 'fnStr' holds 7 numbers? Can you give a sample?
HTH
Good luck
Go to the top of the page
 
+
pflute4
post Jul 24 2006, 11:16 AM
Post #5

New Member
Posts: 8
From: Illinois



AB12345
Go to the top of the page
 
+
freakazeud
post Jul 24 2006, 11:19 AM
Post #6

UtterAccess VIP
Posts: 31,413
From: NC, USA



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
Go to the top of the page
 
+
pflute4
post Jul 24 2006, 11:36 AM
Post #7

New Member
Posts: 8
From: Illinois



By UNC path, you mean the server? OK, I tried that, and I'm still getting the same error.

pflute4
Go to the top of the page
 
+
freakazeud
post Jul 24 2006, 11:40 AM
Post #8

UtterAccess VIP
Posts: 31,413
From: NC, USA



Are you sure the full UNC path is correct.
Check this article for some more.
HTH
Good luck
Go to the top of the page
 
+
pflute4
post Jul 24 2006, 12:03 PM
Post #9

New Member
Posts: 8
From: Illinois



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.
Go to the top of the page
 
+
freakazeud
post Jul 24 2006, 12:13 PM
Post #10

UtterAccess VIP
Posts: 31,413
From: NC, USA



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
Go to the top of the page
 
+
pflute4
post Jul 24 2006, 12:26 PM
Post #11

New Member
Posts: 8
From: Illinois



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
Go to the top of the page
 
+
freakazeud
post Jul 24 2006, 12:30 PM
Post #12

UtterAccess VIP
Posts: 31,413
From: NC, USA



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
Go to the top of the page
 
+
pflute4
post Jul 24 2006, 12:45 PM
Post #13

New Member
Posts: 8
From: Illinois



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
Go to the top of the page
 
+
freakazeud
post Jul 24 2006, 12:47 PM
Post #14

UtterAccess VIP
Posts: 31,413
From: NC, USA



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!
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 26th May 2013 - 01:28 AM