Exporting from From Issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
__________________________________________
 
Back
Top