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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem creating a CSV file from a table

Status
Not open for further replies.

jmc014

Technical User
Nov 24, 2007
80
0
0
ES
Hi,

I working on a function that, in theory, should generate a csv file from a table.

While all the fields belonging to the table are TEXT, I always get the same error:
Text file specification field separator matches decimal separator or text delimiter.

I'm really not sure why this error is coming up, if I create a XLS file, I can convert the file from XLS to CSV without receiving any errors.
That leads me to thing that the code that I am using is wrong?

Here it is:

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim MyPath As String
Dim StrError As String
MyPath = GetPath(Me)
MyPath = MyPath & "\MYFILE.csv"

DoCmd.TransferText acExportDelim, , "CSVExport", MyPath, True

StrError = "File has been created: " & MyPath
MsgBox StrError, vbInformation, "System Information"

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub


Can anyone push me in the right direction?
Thanks,
 
Without knowing your version, that looks correct to me. What about exporting it to .txt, using "," as the delimeter?
 
Sorry, I'm using Access 2007.

Problem is that I need to use a CSV file for and EDI upload to another system.

Thanks,
 
If you export to text with a comma delimeter, you can then change the file extension from .txt to .csv. I've done the reverse and it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top