C
cox
Help with a combo box
I have a database with the following tables:
Table_customer_link_number
Table_customer_number
Table_customer_name
Table_customer_address
Table_customer_notes
Each table is linked by id to id2. Each table is 1 to many. I have a combo
box (cmbuser) used as a filter to select records by user name. The field is
table_customer_link_number.samid. This combo box works fine. I have a 2nd
combo box that I want to use to filter the records even further by whether
the record is open or closed (cmbstatus1). This field is located here:
table_customer_pfr.status How can I get this second filter to work? I have
tried the following query, but it does not work:
SELECT DISTINCT table_customer_pfr.status
FROM ((table_customer_link_number INNER JOIN table_customer_number ON
table_customer_link_number.ID=table_customer_number.id2) INNER JOIN
table_customer_name ON table_customer_number.ID=table_customer_name.id2)
INNER JOIN (table_customer_address INNER JOIN table_customer_notes ON
table_customer_address.ID=table_customer_notes.id2) ON
table_customer_name.ID=table_customer_address.id2
WHERE (((table_customer_link_number.samid)=!forms![form main]![cmbuser]));
Here is my code for the 2 combo boxes:
Private Sub cmbstatus1_AfterUpdate()
Me.Filter = "[table_customer_notes]![status] = """ & Me!cmbstatus1 &
""""
Me.FilterOn = True
End Sub
Private Sub cmbuser_AfterUpdate()
Me.Filter = "[table_customer_link_number]![samid] = """ & Me!cmbuser &
""""
Me.FilterOn = True
Me!cmbstatus1 = Null
Me!cmbstatus1.Requery
End Sub
Thanks in advance,
Bob W.
I have a database with the following tables:
Table_customer_link_number
Table_customer_number
Table_customer_name
Table_customer_address
Table_customer_notes
Each table is linked by id to id2. Each table is 1 to many. I have a combo
box (cmbuser) used as a filter to select records by user name. The field is
table_customer_link_number.samid. This combo box works fine. I have a 2nd
combo box that I want to use to filter the records even further by whether
the record is open or closed (cmbstatus1). This field is located here:
table_customer_pfr.status How can I get this second filter to work? I have
tried the following query, but it does not work:
SELECT DISTINCT table_customer_pfr.status
FROM ((table_customer_link_number INNER JOIN table_customer_number ON
table_customer_link_number.ID=table_customer_number.id2) INNER JOIN
table_customer_name ON table_customer_number.ID=table_customer_name.id2)
INNER JOIN (table_customer_address INNER JOIN table_customer_notes ON
table_customer_address.ID=table_customer_notes.id2) ON
table_customer_name.ID=table_customer_address.id2
WHERE (((table_customer_link_number.samid)=!forms![form main]![cmbuser]));
Here is my code for the 2 combo boxes:
Private Sub cmbstatus1_AfterUpdate()
Me.Filter = "[table_customer_notes]![status] = """ & Me!cmbstatus1 &
""""
Me.FilterOn = True
End Sub
Private Sub cmbuser_AfterUpdate()
Me.Filter = "[table_customer_link_number]![samid] = """ & Me!cmbuser &
""""
Me.FilterOn = True
Me!cmbstatus1 = Null
Me!cmbstatus1.Requery
End Sub
Thanks in advance,
Bob W.