filter combobox

database

Registered User.
Local time
Today, 11:48
Joined
Jun 3, 2004
Messages
80
hi everyone...

I have a simple problem...but i am not able to solve it... I have two comboboxes and i want to filter the second combobox based on the selection in the first combobox.

its like this:

1st combo: cboGroup
2nd combo : cboSubGroup

I have written the code like this


Private Sub cboGroup_AfterUpdate()
Dim sSubGrpSource As String

sSubGrpSource = "SELECT [tblSubGrp].[SubGroup_id], [tblSubGrp].[Group_id], [tblSubGrp].[SubGroup_name] " & _
"FROM tblSubGrp " & _
"WHERE [Group_id] = '" & Me.cboGroup.Value & "';"
Me.cboSubGroup.RowSource = sSubGrpSource
Me.cboSubGroup.Requery


End Sub


What it does that when i select a grp, it asks for its group id and when u type in , it shows the correct values in the second combobox...

can anyone tell me how do i make the 2nd combo to show values based on the 1st combo without Access prompting to type in its group id???

Thanks,
dB
 

Users who are viewing this thread

Back
Top Bottom