TransferTest

S

Stephen sjw_ost

Hello again,

I am trying to convert this code;
DoCmd.TransferText acExportFixed, "Excludes", "t_ACCT_NUMtemp", _

"\\nsusfla90ce01\cost$\OST\Procedures\Scrub_PrivateLabel\Exclusions\Excludes.txt", True, ""

into this code;
DoCmd.TransferText acExportFixed, "Excludes", "t_ACCT_NUMtemp", _

"\\nsusfla90ce01\cost$\OST\Procedures\Scrub_PrivateLabel\Exclusions\" &
"Excludes_" & Format(Date, "mmddyy") & ".txt"", True, """

The problem is when I run the new code I get the message;
"Cannot update. Database or object is read-only."

I have my specification set up and it works when I use it manually so I know
it is not the spec. All I am looking to do is make the output file name to
have the current days date in it? i.e.
Excludes_102809.txt or
Excludes_102709.txt.

I don't care that it will be overwritten multiple times in a day, I just
need the current days date to show in the file name.

How can I get the transfertext feature to do this? Or do I need to use
another feature?

PS:
It must be in text format.

Thanks for any help
 
P

PieterLinden via AccessMonster.com

If all you are really having trouble with is the creation of the file name,
why not just do it the easy way and build a string to stuff all the pertinent
parts into and then pass that string variable to your TransferText method?
 
S

Stephen sjw_ost

So maybe;
Dim strPTH As String, strFNM As String

strPTH = "\\nsusfla90ce01\cost$\OST\Procedures\Scrub_PrivateLabel\Exclusions\"
strFNM = "Excludes_" & Format(Date, "mmddyy") & ".txt""

DoCmd.TransferText acExportFixed, "Excludes", "t_ACCT_NUMtemp", strPTH &
strFNM, True, """

I 'll try it. Thanks for the suggestion.
I'll let you know how it works out.
 
S

Stephen sjw_ost

Suggestion did not work. Still getting the same error msg;
"Cannot update. Database or object is read-only."

Here is what I put.
Function Macro4()
On Error GoTo Macro4_Err

Dim strPTH As String, strFNM As String

strPTH =
"\\nsusfla90ce01\cost$\OST\Procedures\Scrub_PrivateLabel\Exclusions\"
strFNM = "Excludes_" & Format(Date, "mmddyy") & ".txt"" "

DoCmd.OpenQuery "q_ACCT_NUM", acViewNormal, acEdit

DoCmd.TransferText acExportFixed, "Excludes", "t_ACCT_NUMtemp", strPTH &
strFNM, False, ""

DoCmd.DeleteObject acTable, "t_ACCT_NUMtemp"

Macro4_Exit:
Exit Function

Macro4_Err:
MsgBox Error$
Resume Macro4_Exit
End Function

Thanks for helping
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

TransferText 3
format 1 digit year 1
Countdown macro - display settings 2
ahtCommonFileOpenSave 3
Transfer Text and Windows Vista 5
Export to File with Current Date 2
Exporting a date field 2
Share Workbook 1

Top