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!

Criteria Forumla in Query 1

Status
Not open for further replies.

bkrampe

IS-IT--Management
Nov 30, 2006
77
US
I am having a problem getting the code i need in the criteria section of a query. The query is looking at a table that has 2 columns the second one being a partID (1,2,3,etc.) The PartID combo box is looking at the query and when a Specie is selected i only want certain ones to show up. For Example, if we select lets say Maple in the Specie combo box i want it to select all the records with 2(Maple) in the PartID, which is all of our maple parts.(1-Cherry and so-on)
 
Do you mean:

SELECT WhatEver, PartID
FROM tblTable
WHERE PartID=Forms!frmALoadedFormName!cboPartID
 
What do i need to put in for the Forms!frmALoadedFormName!cboPartID line? When its in there i keep getting a parameter prompt when i click on the PartID drop down. My form name is Scrap Cost.
 
Then it would be:

Forms![Scrap Cost]![Name of Dropdown]

You need square brackets when you have spaces. It is always best to avoid spaces in form, control, table and field names as it just leads to grief.
 
This the code that i have so far, and when i click on the PartID dropdown it pops up a Enter Parameter Value box that has detai of Forms!ScrapCost!Specie and no matter what i put in it comes up blank. Thanks for your help guys.

SELECT FS, MaterialID
FROM [FS-CHERRY]
WHERE PartID=Forms![ScrapCost]!PartID;
 
Check the names of everything you show Scrap Cost both with and without a space in the posts above. It is often useful to use the expression builder.
 
Alright i did forget to put a space. Thanks its been a long week.

SELECT FS, MaterialID
FROM [FS-CHERRY]
WHERE PartID=Forms![Scrap Cost]!PartID;

is the code i have now. The last part is that supposed to be the combo box with the query im working with or the box i want it to look at. I have tried it both ways and it no longer gives me a parameter box but when i click the down arrow there is no information in it.
 
Are you trying to make two combo boxes dependent on one another? If so, there is a FAQ.
 
I am trying to make it to where if i select Maple in a Species combo box that then it changes the criteria in the PartID combo box to display only the ones that have to do with Maple. All Maple entries have a MaterialID of 1 and all Cherry entries have a MaterialID of 2. So when you change the Specie box to Cherry it will change the PartID box occordingly. I hope i have not made this confusing. If you need more info let me know. Thanks again Remou
 
That is what would be called a dependant combo. Try this faq702-4289
 
After your previous message i went and searched for dependant combo box and found it. I didnt know what they would be called. Thanks for all your help Remou. Sorry if i inconvienced you.
 
No problem, I find it takes a while to get the language.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top