Hello everyone. This is a pretty simple problem, but I can't seem to find a solution due to my beginner status.
I have a form that has a button that runs a macro that opens a report. It works great; however, I want to adjust the macro by including an If statement. Normally that is no problem. But in this case it is problematic because I want the If statement to be based off of a query (Query1). My query will always only have one row of data with one field called "ER_Pay_Schedule". This field will say "YES" or be null - depending on what the user selects on the form.
The If statement looks like this: [Query1]![ER_PAY_SCHEDULE]="YES"
When I try to run it, I get this error message:
"The object doesn't contain the Automation object 'Query1.'
You tried to run a Visual Basic procedure to set a property or method for an object. However, the component doesn't make the property or method available for Automation operations.
Check the component's documentation for information on the properties and methods it makes available for Automation operations."
Basically I just want to set it up so that when the user clicks the button one of 2 things will happen depending on what pay schedule the employee is on. Our employees can only be on one of two pay schedules. The user selects the employee name from the combo box on the form. A different query (EMP_SELECTED) uses the combo box as the criteria for the report.
BUT if the employee is on the ER PAY SCHEDULE they will get REPORTA. If the employee is on the REGULAR PAY SCHEDULE they will get REPORTB.
I have included a picture of the macro that is embedded into my button.
Thanks in advance for the help!!!