Full Version: Filter date on subform
UtterAccess Forums > Microsoft® Access > Access Forms
edin14166
Hi,
I have a subform with records spanning from last three years.
A date field format(dd/mm/yyyy) on a subform which I would like to filter via additional comboBox containing last three years 2006,2007,2008.
I need to make it possible for the user when the year 2008 is choosen on the combobox then the subform should show only records from containing 2008 in the date field on the subform....
How can it be done ?
freakazeud
Hi,
base the subfom on a query. Within the query create a new expression that pulls out the year from your date field e.g.:
ustYear: Year([YourDateField])
Set criteria on that expression to reference your main form combo box e.g.:
[Forms]![YourForm]![YourComboControlName]
This reference assumes that the bound column of the combo returns the appropriate values e.g. 2008, 2003...
Now all you have to do is requery the subform in the after update event of the combo control e.g.:
Me.YourSubformControl.Form.Requery
HTH
Good luck
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.