423,834 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,834 IT Pros & Developers. It's quick & easy.

Combo with Select Row Query with Multiple ID numbers.

P: 36
I have the current code for populating one combo box off another combo box:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo110_AfterUpdate()
  2.   With Me![Combo112]
  3.     If IsNull(Me!Combo110) Then
  4.       .RowSource = ""
  5.     Else
  6.       .RowSource = "SELECT [Root_Cause] " & _
  7.                    "FROM xRoot_Cause " & _
  8.                    "WHERE [ID]=" & Me!Combo110
  9.                           End If
  10.     Call .Requery
  11.   End With
  12. End Sub
My question is if Root_Cause has multiple Ids from table me!Combo110 can it work ?
Feb 18 '10 #1
Share this Question
Share on Google+
1 Reply


Expert Mod 2.5K+
P: 2,545
Hi again.

When you reference the value property of combo Me!Combo110 you are retrieving whatever single item element is set as its current value. Unlike a list box which you can set to allow multi-select, combos return single values only.

You have already guarded aginst a null (when no selection has yet been made), so your combo will contain a value. The number of other values in the source of the combo will not affect what is selected. Your Where clause should work OK as long as the value in the combo does match an ID in your xroot_cause table; if not, no rows will be returned by your SELECT statement.

If the ID in your xroot_cause table is not unique (depending on what you mean by 'multiple IDs from the root cause table) then multiple rows will be returned by your WHERE clause as the rowsource for your next combo.

I presume you do not mean table me!combo110 (as the combo is not a table) but whatever table or query is the rowsource for combo110.

-Stewart
Feb 18 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.