Connecting Tech Pros Worldwide Help | Site Map

Forms AfterUpdate

Newbie
 
Join Date: Feb 2008
Posts: 2
#1: Feb 28 '08
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's Avatar
Expert
 
Join Date: Apr 2007
Location: Mexico City
Posts: 1,155
#2: Feb 28 '08

re: Forms AfterUpdate


Quote:

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?
Newbie
 
Join Date: Apr 2009
Location: Ontario, Canada
Posts: 2
#3: Apr 29 '09

re: Forms AfterUpdate


I have a similar question.
In the "Filter part" of the form, combo boxes populate the data for YearFilter and Cat(egory)Filter. 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 "AfterUpdate" of the ComboBox, I have

Private Sub cboYearFilter_AfterUpdate()
[Forms]![frmMainMenu]![txtCorpPgmYear] = cboYearFilter
Call ApplyCorpFilters
End Sub

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

YearFilter = [Forms]![frmMainMenu]![txtCorpPgmYear]
CatFilter = [Forms]![frmMainMenu]![txtCorpCategoryFilter]

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.CorpProgram"
Me.Refresh
End Sub
Reply