Filtering a combobox based on another combox selection

dataheadache

Registered User.
Local time
Today, 16:05
Joined
Feb 18, 2004
Messages
28
I've created a form in my database that has two combo boxes - one called cboID (which gets data from my table field called DiscID) and the other cboSide (which gets data from the table field DiscSide) - I want to update the cboSide combobox so it shows only DiscSides that were used on a particular DiscID

I have put the following in the cboID RecordSource in the AfterUpdate event:
Private Sub cboID_AfterUpdate()
Dim cboSide2 As String

cboSide2 = "SELECT DISTINCT [recordedtbl].[DiscSide] " & _
"FROM recordedtbl " & _
"WHERE [DiscID] = " & Me.cboID.Value
Me.cboSide.RowSource = cboSide2
Me.cboSide.Requery
End Sub

but now every time I run the report I get a data mismatch - what is wrong?
 
Have you seen my post on Cascading Comboboxes in the FAQ section? Done properly, these cascading combos should require one line of code and not the building of a whole new RowSource.
 
Mile-O-Phile said:
Have you seen my post on Cascading Comboboxes in the FAQ section? Done properly, these cascading combos should require one line of code and not the building of a whole new RowSource.

I did follow you guide, and yes, it did work.
 

Users who are viewing this thread

Back
Top Bottom