How to update a record with value from cascading combo box?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ncsthbell
    New Member
    • May 2007
    • 167

    #1

    How to update a record with value from cascading combo box?

    Hello, I hope I can do a good enough job trying to explain this situation!

    I have inherited the maintenance for an access database and I have been requested to make a change to a form to add 2 combo boxes. I am encountering problems with getting the data value from one of the combo boxes (for divisions and groups) to be updated on the record.

    THE FORM:
    frmHardware
    form property record source: HWInventory table (has columns for the division and group on each inventory row of data)

    THE COMBO BOXES:
    CmboDivisions

    Control source property: Division column (on HWInventory table)
    Row Source property: SELECT DivisionName FROM DDDivision ORDER BY DivisionName;
    After Update event: cmboGroup.RowSo urce = "SELECT Division_group FROM division_groups WHERE Division_groups .DivisionName= '" & cmboDivision.va lue & "'"
    * Once the division is chosen, the event code is intended to poplulate the group list box with the valid values for the chosen division.
    * The HWInventory record is updated successfully with the division value in the combo box.

    CmboGroups
    Control source property: Div_group column (on HWInventory table)
    Row Source property: left blank
    Problem:
    * Once the group is chosen, it is populated in the group combo box.
    *A value will be selected from the list of groups in the combo box.
    *The HWInventory record is NOT updated successfully with the value from the group combo box.

    Note: The way this form seems to be designed is a change can be made for any column but to save the change, they have to click on a bar on the left side of the form that shows a ‘pencil’. I have never seen or used this method before. I normally control updates and additions with command buttons on the form. There are no update statements in any of the code for the form so I am assuming that the HWInventory record update is based on the control/row source values defined for each of the text boxes and list or combo boxes on the form.

    With that, I am thinking that the division combo box updates correctly on the record because the rowsource has a specific value (the select statement). Maybe the group is not being updated because I have the rowsource as a blank value as I am using the ‘after update’ event to build the rowsource for the group.

    Any suggestions would be greatly appreciated!!!
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    Check out Cascaded Form Filtering.

    Comment

    Working...