running a "make table" query using VBA

S

scubadiver

"Qry_CCode_MT" is a "make table" query that populates records from another
query but I get an error saying it can't be found. Is there something I am
missing to make it work?

The full code in the "on-click" event is the following:

DoCmd.SetWarnings False
DoCmd.OpenQuery "Qry_CCode_Del"
DoCmd.OpenQuery "Qry_CCode_MT"
DoCmd.OutputTo acOutputTable, "CauseCodes", acFormatXLS,
"C:\David\databases\Customer Satisfaction\reports\Cause Codes.xls", True
 
J

John W. Vinson

"Qry_CCode_MT" is a "make table" query that populates records from another
query but I get an error saying it can't be found. Is there something I am
missing to make it work?

The full code in the "on-click" event is the following:

DoCmd.SetWarnings False
DoCmd.OpenQuery "Qry_CCode_Del"
DoCmd.OpenQuery "Qry_CCode_MT"
DoCmd.OutputTo acOutputTable, "CauseCodes", acFormatXLS,
"C:\David\databases\Customer Satisfaction\reports\Cause Codes.xls", True

You don't NEED a make-table query, or a delete query either.

You can just change Qry_CCode_MT to a Select query, selecting those records
and fields that you want to export; and export *the query*. If you're assuming
that you must copy data into a table in order to export it... well, you don't.

John W. Vinson [MVP]
 
S

scubadiver

Certainly but I have an extra problem that I hope you might be able to help
me with.

One of the fields in the query lists a constant taken from an unbound text
box because I need it for calculations in each row.

expr1: [forms]![reports]![enqout]

When I export the query into Excel the column is blank so I had the idea of
transferring it into a table to set the column so I could then export all the
information. For some reason this doesn't work either but I hope this can be
resolved.
 
S

scubadiver

I've managed to get it working using a macro.


John W. Vinson said:
You don't NEED a make-table query, or a delete query either.

You can just change Qry_CCode_MT to a Select query, selecting those records
and fields that you want to export; and export *the query*. If you're assuming
that you must copy data into a table in order to export it... well, you don't.

John W. Vinson [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

Top