Exporting from From Issue

S

Sash

I'm trying to export a file to c:\DOCS\mmddyyyy.txt I'm running th following
in a click event and it doesn't seem to like the fact that hte file name
hasn't been created. Any advise???


Dim stSpecs As String
Dim stExport As String
Dim stExpName As String

stExpName = "c:\DOCS" & Format(Date, "mmddyyyy") & ".txt"


stSpecs = "ExportSpecification"
stExport = "Export"

DoCmd.TransferText , stSpecs, stExport, stExpName
 
T

Tom Wickerath

Hi Sash,
I'm trying to export a file to c:\DOCS\mmddyyyy.txt ....

Add a debug.print statement, and compare the result:

stExpName = "c:\DOCS" & Format(Date, "mmddyyyy") & ".txt"
Debug.Print stExpName

---> c:\DOCS09202007.txt

It looks to me like you are missing a backslash in stExpName.

Also, you have not specified the optional TransferType parameter, so the
default, "acImportDelim", is applied. I believe you want "acExportDelim", as
in:

DoCmd.TransferText acExportDelim, stSpecs, stExport, stExpName

Your table or query is named "Export", correct? And you have an Export
Spec. named "ExportSpecification", correct?


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

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

Top