Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2014

    Unanswered: How to populate a form after 3 combo boxes are used

    I am new to coding. I have made a database. I have gotten down to the point where I want to use a form to get the information. I am trying to get the information to auto populate fields after using 3 drop menus. They are department name, shop and shift. All of the information comes out of tbl department name, tbl shop and tbl shift. I also have a main table with department name, shop, shift, line, employee total, shift leader total, ratio of shift leaders per line and total employees off. I am trying to figure out once I use the 3 drop down how can I Auto populate the remaining fields. Also I am trying to figure out where and how to put in the code is it AfterUpdate.

  2. #2
    Join Date
    Apr 2014
    Provided Answers: 23
    After all 3 combos are picked, you'll need an APPLY button (in case 1 is picked wrong)
    the click event would filter the form records.

    Dim vFilt
      'build a filter from combos
    If Not IsNull(cboDept) Then vFilt = "[dept]='" & cboDept & "' and "
    If Not IsNull(cboShop) Then vFilt = vFilt & "[Shop]='" & cboShop & "' and "
    If Not IsNull(cboShift) Then vFilt = vFilt & "[Shift]='" & cboShift & "' and "
    If vFilt = "" Then
      DoCmd.FilterOn = False
           'remove the last AND from filter
      vFilt = Left(vFilt, Len(vFilt) - 5)
      DoCmd.Filter = vFilt
      DoCmd.FilterOn = True
    End If

Posting Permissions

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