Forms AfterUpdate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IqbalEva
    New Member
    • Feb 2008
    • 2

    Forms AfterUpdate

    I have a form and a subform. After updating one of the cboBox in the main form [Supplier] I would like the cboBox [Products] in the subform to filter out only the products from the supplier selected above. Currently the subform picks all the products from all suppliers.
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by IqbalEva
    I have a form and a subform. After updating one of the cboBox in the main form [Supplier] I would like the cboBox [Products] in the subform to filter out only the products from the supplier selected above. Currently the subform picks all the products from all suppliers.
    and your data base is in SQL? excel? access?? or is it a list you have in a combo or a listbox?

    Comment

    • RogerThis
      New Member
      • Apr 2009
      • 2

      #3
      Updating Forms by Filter

      I have a similar question.
      In the "Filter part" of the form, combo boxes populate the data for YearFilter and Cat(egory)Filte r. The default values are preload and the filter works "On Load", but I can't get the data to refresh in the sub-form.. I also tried requery

      The "AfterUpdat e" of the ComboBox, I have

      Private Sub cboYearFilter_A fterUpdate()
      [Forms]![frmMainMenu]![txtCorpPgmYear] = cboYearFilter
      Call ApplyCorpFilter s
      End Sub

      -----------------------------
      Private Sub Form_Load()
      Call ApplyCorpFilter s
      Me.Refresh
      End Sub
      ---------------------------------
      Private Sub ApplyCorpFilter s()
      Me.AllowFilters = True

      YearFilter = [Forms]![frmMainMenu]![txtCorpPgmYear]
      CatFilter = [Forms]![frmMainMenu]![txtCorpCategory Filter]

      If CatFilter <> "(All)" Then
      strFilter = "([Year] = '" & YearFilter & "' AND [Category] = '" & CatFilter & "')"
      Else
      strFilter = "[Year] = '" & YearFilter & "'"
      End If

      Me.RecordSource = "SELECT CorpPrograms.* FROM CorpPrograms WHERE " & strFilter & " ORDER BY CorpPrograms.Co rpProgram"
      Me.Refresh
      End Sub

      Comment

      Working...