I have a form set as a dialog box with 2 Combo boxes (Combo0 & Combo4) and 2 text boxes (text8 & text10).
The form's record source is set to a table named Customers.
Combo0's row source is set to a query conatining the Customer Name Field in Customers
Combo4 lists only the citys of whaterver customer is picked from combo0.
Text10's control source is the state field in customers
Text8's control source is a unique ID field in customers.
When you choose a customer name in combo0 and then a city in combo4 text10 & text8 become visible and dsplay the related state and unique ID for that location.
My problem is that if there is more than one customer in the same city my code only returns the state(Text10) and unquie ID(Text8) for the first match that it comes to in the table.
Here's the code of combo0 AfterUpdate:
Expand|Select|Wrap|Line Numbers
- Dim wclause
- [Combo4].Visible = True
- wclause = "SELECT Customers.CITY FROM Customers WHERE customers.[company name]=[combo0];"
- [Combo4] = " "
- [Combo4].RowSource = wclause
Expand|Select|Wrap|Line Numbers
- Dim rs As Object
- Set rs = Me.Recordset.Clone
- rs.FindFirst "[CITY] = '" & Me![Combo4] & "'"
- If Not rs.EOF Then Me.Bookmark = rs.Bookmark
- [Text10].Visible = True
- [Text8].Visible = True
I'm sure the problem is in the code of combo4 but I don't know how to fix it. Any help would be greatly appreciated and Thanks in advance!