Results 1 to 2 of 2

Thread: Forms - Combo Box Question

  1. #1
    Join Date
    Mar 2006
    Posts
    29

    Forms - Combo Box Question

    I work for a law firm where we have a table of client numbers. There is a table of matters that we work on for the clients and each matter has a field for the client number that can link back to the client table.

    I am working on a form that will add records to a new table. Here is what I am trying to get the form to do:

    1. Select a Client Name from Combo Box A using the client database as the list.
    2. Once Client Name is selected, the client number populates a field on the form called "Client Number"
    3. Based on the Client Number selected in Combo Box A or in the field called "Client Number", use Combo Box B to select ONLY THOSE MATTERS for the client number that is selected in Combo Box A. I built a query that uses the matter database narrowed down to the client number that is selected using Combo Box A to populate Combo Box B.
    4. Select the matter from Combo Box B and then populate a field on the form called "Matter Number".

    My problem is this: When I first open the form and select my client in Combo Box A, it works fine. Then, I select Combo Box B and it gives me the list of matters only for that client. BUT, if I happen to change my mind and go back to Combo Box A and CHANGE the client, Combo Box B does not update for the new client and shows me only the matters for the first client that I selected before I changed my mind. In the query that is used for Combo Box B, to narrow down the list of matters, I have tried to use the Combo Box A field and the field that is populated with the Client Number selected from Combo Box A but neither of these will fix the problem.

    What am I doing wrong??

    Thanks for any advice!

  2. #2
    Join Date
    Mar 2006
    Posts
    29
    I got an answer:

    The code to set the row source for the 2nd combo box should be in the After Update event of the 1st combo box.

    This line should do the trick:

    Me.NameOfSecondComboBox.Requery

    Open the form in design view. Get the properties of combo box A. On the Events page, click inside the text box of the After Update row. Then click the ... button at the end of the row. The code window should open and you should be "inside" the correct event. Then just type in the code line that I sent you earlier, changing the names to suit, of course.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •