Advertisement

10.01.2005 at 09:31PM PDT, ID: 21581001
[x]
Attachment Details

Dynamic combo box rowsource based on prior combo box value

Asked by opho in Microsoft Access Database

Tags: combo, box, dynamic, rowsource, based

My first combo box, Category, may be Race, Gender, or Age.  

My second combo box, Group, is based on the first.

I have this sub:

Private Sub Form_Current()
Dim Categry As Integer
Categry = Nz(Me!CategoryID.Value, 0)
GroupID.RowSource = "SELECT ReferenceID, ReferenceDesc FROM ReferenceLists WHERE (ReferenceList = " & Categry & ") ORDER BY Seq"
End Sub

When I first open the form, the first record shows up as needed:
 * Category was already defined as Gender.
 * Group was already Female.
 * Everything displays properly.

I press PageDown, and the second record also is displayed properly:
 * Category was already defined as Gender.
 * Group was already Male.

But the third record is not so good:
 * Category, already defined as Race, is displayed properly.
 * Group seems to be blank, but after pressing alt-Tab twice, it shows up as "African American", which is what is needed.

I press PageUp, going back to the second record and:
 * Category, already defined as Gender, is displayed properly.
 * Group seems to be blank, but after pressing alt-Tab twice, it shows up as "Male", which is what is needed.

It must be that I'm not linking my RowSource logic with the appropriate event, but I've been tickling this thing for 4 hours already, and I'm ready for any insight that will give me a clue on how to make this work intuitively.

Thanks!Start Free Trial
[+][-]10.01.2005 at 09:38PM PDT, ID: 15001063

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Access Database
Tags: combo, box, dynamic, rowsource, based
Sign Up Now!
Solution Provided By: jjafferr
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32