Code to set query parameter through command button?

A

Aaron

Hi:

I have a command button on a form that triggers a print job of a report that
references a query with a parameter.

I'd like to set that parameter (named [entryid]) off of the id field of the
record that I am viewing on the form.

Thanks in advance,
Aaron
 
J

John W. Vinson

Hi:

I have a command button on a form that triggers a print job of a report that
references a query with a parameter.

I'd like to set that parameter (named [entryid]) off of the id field of the
record that I am viewing on the form.

Thanks in advance,
Aaron

Cut out the middleman: change the criterion from [entryid] to

[Forms]![yourformname]![entryid]

using the name of your form and the control on the form containing that ID.

Alternatively, you can use the WhereCondition argument in the OpenForm method
- see the vba help for the Openform Method for details.
 

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