transferspreadsheet method but set query criteria from vba?

B

Bill

Greetings.
Access 2003
Excel 2003

To get some information from an access form to an xl spreadsheet is it
possible to set the criteria in the underlying query to say a value from the
form.
The criteria is the current records "ID".
Only two field values are required to be sent.
The transferspreadsheet opens the query and sends it to excel with the
information set by the criteria / filter.

Best Regards
Bill
 
F

fredg

Greetings.
Access 2003
Excel 2003

To get some information from an access form to an xl spreadsheet is it
possible to set the criteria in the underlying query to say a value from the
form.
The criteria is the current records "ID".
Only two field values are required to be sent.
The transferspreadsheet opens the query and sends it to excel with the
information set by the criteria / filter.

Best Regards
Bill

Let's assume the form's name is "MyForm" and the name of the control
on the form that contains the value is [ID].

In the query, as criteria on the ID column, write:
Forms!MyForm!ID

The form "MyForm" MUST be open when the TransferSpreadsheet code is
run.
NOTE: TransferSpreadsheet does not open the query (it's not
necessary).
It just sends the Query data to Excel.
 

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