Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Docmd.transfertext issue 1

Status
Not open for further replies.

44nato44

Programmer
Dec 12, 2008
115
NL
I am trying to do an export with the delimiter ^, but it only delimits the first row and the rest is comma delimited.

I tried to make a export schema file from access and it works, but he export scema file does not follow the database so I can I make it do this ?

My export code :

DoCmd.TransferText acExportDelim, , "Core-ParticipantData", "g:\MLLPDev\test.txt", True

My export schema.ini file :

[test.txt]
Format = Delimited(^)
 
Personally I never use the TransferText option as I find it too clunky and limiting.
A much better alternative is to use the class available at
It's well documented, but in short:
Import the cls file into your database and where you have your DoCmd line replace it with
Code:
Dim TE As TextExport
 Set TE = New TextExport
 With TE
   .ExportDatabase = CurrentDb
   .ExportSource = "Core-ParticipantData" 
   .AppendToFile = False 'optional, default is False
   .ExportFilename = "g:\MLLPDev\test.txt" 'existing file will be overwritten unless AppendToFile is True
   .FieldDelimiter = "^"
End With

Yes it's a little more to type, but it's worth the extra.

hth

Ben

----------------------------------------------
Ben O'Hara
David W. Fenton said:
We could be confused in exactly the same way, but confusion might be like Nulls, and not comparable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top