INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Problem creating a CSV file from a table

Problem creating a CSV file from a table

(OP)
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,

RE: Problem creating a CSV file from a table

Without knowing your version, that looks correct to me. What about exporting it to .txt, using "," as the delimeter?

RE: Problem creating a CSV file from a table

(OP)
Sorry, I'm using Access 2007.

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

Thanks,

RE: Problem creating a CSV file from a table

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close