Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing multiple variables 1

Status
Not open for further replies.

HMJ

Technical User
Nov 29, 2002
58
US
I am advancing into another new area for me in the VBA arena. I am trying to pass variables to a report query. I have passed one variable – i.e. year – before, but now I am trying to pass two or three variables.

In a query we might see:
Class Date Grade
=3 =02/10/03 >75
This would be hard coded into the query. Now I am using a drop down in a form where the class and/or date and/or grade breakpoint can be selected. This info needs to get to the query when I run the report.

Can anyone help me?

Thanks.


Harry Jessen
HMJessen@Yahoo.com
 
hi Harry.

instead of entering hardcoded values like in your example
above, you will need to reference the field value on the form directly.

to do this, insert the following in the criteria section of the field you're referencing.

Forms!NameofYourForm!FieldName.value

Replace NameofYourForm and FieldName as is applicable to you.

if on your form, you want to leave this field blank sometimes, and have Access skip the field in the query process, include the following instead.

Like iif(Forms!NameofYourForm!FieldName.value is null,"*",Forms!NameofYourForm!FieldName.value)

hope this helps you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top