Tranfertext Error

wjburke2

Registered User.
Local time
Today, 06:30
Joined
Jul 28, 2008
Messages
194
I am trying to create a text file from a table. I used the TransferText command to do this. The program was working fine when I gave it this file name (\\o2nas1\FullService_SampleData\FullSerACS.txt) but when I try to build the file name by using the letter "F", 6 digit date and .txt (\\o2nas1\FullService_SampleData\F100509.txt). I get a error "Cannot update. Database or object is read-only." I was thinking it was a bad file name but I can cretae the fie with Notepad. Is this a Assess issue?

This is the code:
FromPath = Left(InFileName, InStrRev(InFileName, "\"))
WorkDate = Format(Date, "YYMMDD")
OutFileName = FromPath & "F" & WorkDate & ".txt "

DoCmd.TransferText acExportFixed, "FullServiceUnionSpec", "FullServiceUnion", OutFileName, False
 
This is the code:
FromPath = Left(InFileName, InStrRev(InFileName, "\"))
WorkDate = Format(Date, "YYMMDD")
OutFileName = FromPath & "F" & WorkDate & ".txt "

DoCmd.TransferText acExportFixed, "FullServiceUnionSpec", "FullServiceUnion", OutFileName, False

and how does this code compare to the code you had to create the file (\\o2nas1\FullService_SampleData\FullSerACS.txt)?

i suspect it's probably got something to do with the "Date" part, but i'm not sure. i'd like to first see what your original code was, which worked for you...
 
Thanks for replying wiklendt, my original code was really simple:
OutFileName = FromPath & "OneCodeACS_Exp.txt". I found the problem this morning. Funny what a freash set of eyes will do. If you notice at the end of where I build the filename I have a space after ...txt ". That fixes the problem. A mistake only I could make.
 
Last edited:
have you tried throwing in a message box with the path displayed, to see if it comes up fine? it's a trick i use when i'm attempting to pass compound variables...
 
Thanks for replying wiklendt, my original code was really simple:
OutFileName = FromPath & "OneCodeACS_Exp.txt". I found the problem this morning. Funny what a freash set of eyes will do. If you notice at the end of where I build the filename I have a space after ...txt ". That fixes the problem. A mistake only I could make.

ah great - glad you fixed it. i didn't even notice it! good work. :)
 

Users who are viewing this thread

Back
Top Bottom