Export to text

C

ChoonBoy

I am trying to get the code below to work but with no success. The objective
is to export to a text file using the sql statement instead of creating a
save query than do the transfer. Appreciate any help, thanks in advance.


Dim strsql as string

Strsql =â€SELECT qryCountItmUsers.[Item No], Count(qryCountItmUsers.Cust) AS
CountOfCust, qryCountItmUsers.[Sman Code] FROM qryCountItmUsers GROUP BY
qryCountItmUsers.[Item No], qryCountItmUsers.[Sman Code];â€


DoCmd.TransferText acExportDelim, "", " Strsql ", "c:\RMDB\TblOrders3a.txt",
False, ""
 
T

Tom van Stiphout

On Mon, 9 Feb 2009 05:24:01 -0800, ChoonBoy

Putting StrSql between double-quotes is certainly incorrect, but even
when fixed this is not going to work: Access requires the name of a
table or query.
What's wrong with dynamically assigning the SQL to a query, and then
using it for export? Lookup the Qry property for a Querydef object.

-Tom.
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Export to text 1
Timeout issue 1
Excel Export Filtered Form Data To Excel 0
VBA code issue...Would love expert help. 5
export to text file problems 2
Export form data to text file 7
Shell Error 10
Form Not Visible 2

Top