T
Telobamipada
I have a Database (Access 2003) with a form containing 2 combo boxes one
dependent on the other. The 1st (DME) using Table (DMEBusiness) and the other
(Phone) using Table (DMEPhone). When a Business is selected in my (DME) combo
box I would like for the (Phone) combo box to display phone numbers for that
business. Presently, it will display only one phone number for each business
with no others available in the combo box. I am using the code below which is
not working for me. Could someone help me with this please?
Private Sub DME_AfterUpdate()
Me.Phone.RowSource = "SELECT DMEPhone.[Phone] FROM" & _
" DMEPhone WHERE BusinessID = " & Me.DME & _
" ORDER BY Phone"
Me.Phone = Me.Phone.ItemData(0)
End Sub
The 2 Tables are set up as such:
DMEBusiness
BusinessID = AutoNumber
Business = Text
DMEPhone
PhoneID = AutoNumber
Phone = Text
BusinessID = Number (Matches Business ID field in DMEBusiness)
Lookup settings: Display Control = Combo Box
Row Source Type = Table/Query
Row Source = SELECT DISTINCTROW [BusinessID], [Business] FROM
DMEBusiness ORDER BY [Business];
dependent on the other. The 1st (DME) using Table (DMEBusiness) and the other
(Phone) using Table (DMEPhone). When a Business is selected in my (DME) combo
box I would like for the (Phone) combo box to display phone numbers for that
business. Presently, it will display only one phone number for each business
with no others available in the combo box. I am using the code below which is
not working for me. Could someone help me with this please?
Private Sub DME_AfterUpdate()
Me.Phone.RowSource = "SELECT DMEPhone.[Phone] FROM" & _
" DMEPhone WHERE BusinessID = " & Me.DME & _
" ORDER BY Phone"
Me.Phone = Me.Phone.ItemData(0)
End Sub
The 2 Tables are set up as such:
DMEBusiness
BusinessID = AutoNumber
Business = Text
DMEPhone
PhoneID = AutoNumber
Phone = Text
BusinessID = Number (Matches Business ID field in DMEBusiness)
Lookup settings: Display Control = Combo Box
Row Source Type = Table/Query
Row Source = SELECT DISTINCTROW [BusinessID], [Business] FROM
DMEBusiness ORDER BY [Business];