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

Combo Box, Properties, IIf statement

Status
Not open for further replies.

KIOhio

MIS
Jan 8, 2003
15
US
I have a table with two fields. One field lists categories and the other lists the subcategories for each category. The category is adjacent to each of its subs, therefore the category appears as many times as the number of subs it has.

I have a combo box in an input form that offers the list of categories. I want a second combo box to offer the subcategories that are specific to the selected category. I believe this requires an IIF statement on the Row Source line of the properties window. How can I write the nested if to select only the appropriate sub categories?

Thanks,

Dan, KIOhio
 
Hi

If I understand your question correctly you need:

First combo, cboCategory, with a rowsource, based on a SELECT DISTINCT query, so that user sees each Category only once

Second Combo, cboSubCategory, with a rowsource based on your table as you describe, but with a criteria of Forms!YourForm!cboCategory (using your own form name of course).

In the got focus event of cboSubCategory put code so:

If IsNull(cboCategory) Then
msgbox "Please enter Category"
cboCategory.SetFocus
Else
cboSubCAtegory.Requery
End If
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top