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!

Form based on query with criteria from another form....

Status
Not open for further replies.

BakerUSMC

Technical User
May 24, 2003
96
US
Hello to all,

I hope this doesn't sound too weird or complicated but I will do my best...

I have a form (frmSelect) that has 2 combo box's to select a Project and a Country. Those values are stored in a table (tblSelect).

I have a query (qrySelect) that is the recordsource for another form (frmMain). qrySelect has criteria in the Project and Country fields to take the value from frmSelect (Project & Country).

What I want to happen:
1. I want the user to select a project and country on frmSelect
2. Hit a command button to open frmMain
3. frmMain be populated with all the records the qrySelect finds with the same Project and Country from frmSelect

I have as the criteria in the qrySelect:
Code:
[forms]![frmSelect]![Project]  in the Project field
[forms]![frmSelect]![Country]  in the Country Field

this works when I run the query from a command button on frmSelect but when the frmMain opens it asks for these 2 fields...

Please help!!!!

BakerUSMC
 
lupins46,

Acutally, I have it closed once the frmMain opens.

Is this the problem? Does it really need to be open in the background...

Thanks
 
Thanks, but how then would I pull the values from the table that the frmSelect is bound to. There will only be one record in tblSelect so I don't have to worry about how and which record to choose...

Thanks
 
Your query is referring to the textboxes on the form not fields on the table.
I would expect that if the form is open it will be displaying the values required by the query.
 
How would I set the criteria in the query to pull the values from the table so that I don't have to have an open form in the background?

I've tried:
Code:
[tables]![tblSelect]![Project]

But that doesn't work... any suggestions?

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top