Code to set query parameter through command button?

  • Thread starter Thread starter Aaron
  • Start date Start date
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
 
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.
 
Back
Top