Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Location
    Belfast, Ireland
    Posts
    339
    Thanks
    2
    Thanked 0 Times in 0 Posts

    How Do I . . . Update cbo based on another cbo (20

    Hi

    I know that I can add criteria to a control so that it only included records based on, eg, another open form, but if I want to include records in a cbo based on another cbo on the same form, I find that the criteria makes the cbo return no values.

    IE, I have a Form called Benchmarking.
    On this Form, I have two Combo Boxes: The 1st is 'branch' and the 2nd is 'person'.

    I made the person cbo control source criteria = [Forms]![frm_benchmarking]![cboBranch], but I just get a blank cbo after I've entered a Branch and clicked cboPerson.
    I changed the criteria to = [Me]![cboBranch], but this causes a prompt when the Form loads.

    I'm sure it's possible to get Access to rerun the query after a Branch is selected in the cboBranch, but after spending 1/2 hour crawling through the Help Pages, I'm starting to think I'm not going to find the answer.

    Do I add an AfterUpdate Event to cboBranch which will change the RowSource for cboPerson?
    Or do I add an OnClick Event to cboPerson that will rerun the RowSource Query?

    Any help/advise/code, etc would be greatly appreciated.

    Thanks in advance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How Do I . . . Update cbo based on another cbo (20

    The Control Source property of a combo box determines where the value entered/selected in the combo box will be stored. The Row Source determines what is displayed in the list part of the combo box.

    There are basically two ways to make the list part of a combo box depend on the value of another combo box:

    1. Change the Row Source of the combo box in code, in the After Update event of the other combo box (and in the On Current event of the form).
    2. Set the Row Source of the combo box to the name of a query that refers to the other combo box in its criteria. You must then requery the combo box in the After Update event of the other combo box (and in the On Current event of the form).

    Searching for synchronize combo box in this forum will yields lots of hits, and you can also look at How to synchronize two combo boxes on a form in Access 2002 or in Access 2003.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2002
    Location
    Belfast, Ireland
    Posts
    339
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: How Do I . . . Update cbo based on another cbo

    Thanks Hans!

    As you may or may not remember, it's been more than 6 months since I did this database, and it's so easy to forget some of what you taught me during the creation.
    As soon as I saw Requery, I could've kicked mself.

    Naturally, it worked, so thanks heaps, as usual.

Posting Permissions

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