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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Criteria based on either one of two different forms

Status
Not open for further replies.

eknotts

Programmer
Dec 23, 2002
10
0
0
US
I have a query the requires a field from either one of two forms that opens a third form. The criteria that I currently have:

[Forms]![frmPeopleConCust]![JobID] Or [Forms]![frmPeople]![JobID]

When either of the two calls the third, the data from the un-opened form is requested. For example, if frmPeopleConCust attempts to open the third form, then the query requests the parameter from "frmPeople".

I would like to run this query regardless of which of the two forms are open.

It appears the "OR" does not work as I precieved it would.

I need help!!!!
 
My recommendation would be to create a Global variable in the Database module. Also, create a Function to call up this global variable.
Global vJobID as String
Function JobID()
JobID = vJobID
End Function
If the JobID field in your table is numeric then change the Global variable to a Long.

Now in both of your forms make assignment of the forms JobID control to the variable vJobID as the third form is called up.
vJobID = me![JobID]

Now change the criteria line of the query to JobID() and the query will always select the correct JobID record no matter which of the first two forms are open at the time. Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top