Reputation: 597
I've created a macro that calls up the saved exports menu, so that a query can be exported as a .csv ready for importing to another database.
I'd like to reduce the number of steps for the user though - not just avoiding having to click ok etc, but also the exported file has currency formatting attached to some of the data.
So far my coding looks like this:
Public Function ExportProducts()
DoCmd.TransferText acExportDelim, "ExportSpecs", "ActProductInfo", _
"T:\Documents\Isaac Reefman\Product List", -1
MsgBox "Remember to clear formatting in the .csv file before importing it into Act", _
vbExclamation, "Export Reimnder"
End Function
This leaves me with 2 problems.
Upvotes: 0
Views: 2629
Reputation: 1093
As for the error, you should add the file's extension like:
"T:\Documents\Isaac Reefman\Product List.csv"
As for formatting, you can opt out for formatting when you use the Export Wizard like, don't tick this box:
Export data with formatting and layout
You may also need to re-format in a query, by using CDbl(). Or Str() as Gustav suggested (which is a much much better suggestion!).
So: Str([tblTable].[Field1]) AS NameOfExportColumn, Str([tblTable].[Field2]) AS SecondColumnName
Then export the query instead of a table.
Upvotes: 2