Passing variables to Query Criteria, Can anyone help with this?

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

I am trying to print a report that is based on a query
from a form using a command button. The report contains
information from both the main form and a sub form. The
information for the report comes from a query based on the
two tables the form populates. I need to filter the query
with a criteria from the subform. For example, each job in
the main form can have many change orders in the sub form.
I want the filter for the query to be passed from the sub
form based on the current record in the sub form, a text
box that contains the change order number. Can I pass it
directly to the Query from the sub form or does it go to a
variable first? Can someone give me syntax for my command
button?
 
Eric

Take a look in Access HELP for "expressions". You can use the "Magic Wand"
button in your query design window to select the form/subform/control you
wish to refer to in your criterion. It will look something like (actual
syntax may vary):

Forms!YourMainFormName!subFormControlName.Form!YourSubFromControlName
 
Back
Top