Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005

    Unanswered: Form/Combo Boxes/Relationship?

    I am somewhat new to MS Access and need your help.

    I have a form with 3 combo boxes (the record source is a query of multiple tables. The tables are "Business Unit", "Category" and "Product").

    The first combo box is "Business Unit" that lists 3 different units "A", "B" and "C". When I select a specific Business Unit - I would like only the categories associated within that Business Unit show up in the next combo box field called "Category".

    And then when the Category is selected only have the combo box display Product within that Category.

    Is this possible - or what am I doing wrong? I believe I have the relationships setup correctly because when I go into the table itself - there is a plus sign in the column and when I click on it - the correct associated data show up.

    Any help would be greatly appreciated!! Thank you!

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    What you want to do is realtively simple -it can be done however you need to insert some code behind each to the boxes on click event

    lets say you have 4 comboboxs, and for illustration lets call then combo1,combo2,combo3,combo4

    so when you insert a record you need to freeze combos2..4
    when someone select combo1 then requery combo2, combo2 then requery combo3 etc...

    in the forms 'before insert' event
    combo2.value=null 'SETS A NULL VALUE (IE NO data available)
    combo2.enabled=false 'doesn't allow user to seelct or do anything
    'repeat for combos3 & 4

    in combo1's on click event

    combo2.recordsource= "select colblah, colblah1 from tableblah where colblah=combo1.value order by mysortrequirements"

    then do the same trick with combo 3, except the you refer to combo3 excpet combo1.value becomes combo2.value

    you amy need to consoder some form of error checking on the before update to cater for the situation where the comboboxes have not been selected

    you may need to consider on putting some code in the forms on current event ' which is triggered when a record is displayed to set the comboboxes appropriately

    ie if combo2 has no value then combos 3 & 4 are disabled


Posting Permissions

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