Link to home
Start Free TrialLog in
Avatar of cef_soothsayer
cef_soothsayer

asked on

MS Access VBA export issue

I am trying to export q query result set from MS access to CSV using VBA.  When I run the query, I get 397 rows.  When I run the export, I get nothing.  The export is creating the file, but there are no rows in the file.  The CSV export methods that I have tried are:

   
DoCmd.RunSavedImportExport "Export-MyQuery_CSV"
 
DoCmd.TransferText acExportDelim, , "MyQuery", "E:\path\path\filename.csv", True
   
DoCmd.OutputTo "MyQuery", "E:\path\path\filename", acFormatTXT, True

Funny thing is, when I export to XLS file format, I get the full query results.   All 397 rows.
The XLS export method I am using is:

     
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "MyQuery", "E:\path\path\filename.xls", True

It is too bad that the 3rd party system that I need to export the data for is not capable of using XLS.  Must be CSV.

Help!
Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cef_soothsayer
cef_soothsayer

ASKER

Please Re-read my post.  That was the first method that I tried.  :)

Anyway, I think I found the bug.  Has nothing to do with the method.  Working to confirm the solution now.
<Please Re-read my post.  That was the first method that I tried.  :)>

sorry, but NO. what I posted is NOT the same as what you tried first
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Issue was not code.  It was data.  Confusing at first, but I found it.  Gave other person credit anyway.