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

My form has several items that requ 1

Status
Not open for further replies.

tstowe

Technical User
Apr 29, 2003
65
US
My form has several items that require sizes (located in the combo box pulling from a query) and an associated four digit code (located in an autofill box to the right of it). When I select the combo box the drop down menu shows every item on the list that requires a size selection, i.e. when I am selecting the combo box for Belt - it shows the sizes for not only the belt but for the helmets, the pants, shoes, etc.

MY PROBLEM: I am wanting each combo box to show those items ONLY relating to that specific item, i.e. cbobelt showing only the two sizes from the list; cbohelmet showing only the five size from the list - AND not showing the other items in the list. My research has pulled information about using the following line:

Private cbobelt_Click()
Me.Filter ="cbobelt like 'belt*'"
End Sub

BUT, alas I cannot get this to work either. Anyone that could help in this small issue would be greatly appreciated. Thanks ahead of itme.

 
you would handle this in the rowsource of your combo box.
go into the PROPERTY window of your combo box and click on the BUILD button to the right of ROWSOURCE (the little button with three dots on it). build your query there--i.e. put in whatever criteria you need (ITEM like BELT* or whatever).
 
Thanks for your response. I have already done that step which is allowing me to see the items needing sized. I have a total of 12 different items which are pulling from the same query. If I put the criteria in the rowsource then I will only be able to the one sized item in all 12 instances of the combo box.

Is there a way to relate the rowsource to the specific combo box that I am using? i.e. I have the following abbreviated combo boxes: cbobelt, cbohelmet, cboliner and cboshoes to name a few. Otherwise I will have to create 12 separate queries and that doesn't sound like the best route.

Again, thanks for your help.

Tony
 
so what you are saying is that every combo box is based on the same query?
try this: remove the query name from the rowsource of the combo box.
click on the little BUILD button to the right of RowSource (the button with the three dots on it).
bring in the query you want to use.
put the criteria right there.
this will not change your query at all.

another option is to copy the SQL code that is the query design (in query design, VIEW+SQL). copy that and put into the rowsource of the combo box, then complete the query that is in that particular combo box (with criteria that you want) this way you are putting the SQL right into the rowsource of the combo box instead of basing your rowsource on just the saved query.
 
GingerR,

Thanks for your reply. Your suggestion worked although the actual dbase corrections came from fneily when I am directly emailed him the dbase. Thanks to you both. [medal]

The answer, again thanks to fneily, changed one of my tables slightly and utilized the rowsource property for each combo box to filter the information. First, fneily changed tblSize by removing the primary key (field name "ID")and filling that field according to the type of equipment, i.e. I have five different sized helmets and each ID field for all helmets were labelled "helmet".

Next, fneily went into each combo box (i.e. cbohelmet, cbobelt, cboliner, etc) and placed an SQL statement in the rowsource which selected and showed only the necessary equipment, i.e.

Select [equipment] from tblsize where [ID] = "belt";

The last part, "= "belt" ", changed accordingly to equipment.

Finally he set the Control source for each combo box to the appropriate field in my second table (tblSoldier).

[medal][medal][medal] I am most thankful for both of your time and knowledge!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top