Full Version: Apply a year filter
UtterAccess Discussion Forums > Microsoft® Access > Access Macros
lentin
Is it possible for me to use a drop down box [getyear] with a list/value of 2004;2005;2006 etc to filter records by year on a form by [arrival_date]. arrival_date uses short date format.

I have tried DatePart(yyyy,[arrival_date]= [geyear] on "On Change" but I get the error message that the formula is too complex.

Any help would be appreciated
AJS
Try
Year([Arrival_Date]) = [getyear]

-AJ
lentin
Tried that but it then comes up wanting parameter values for [arrival_date] and then [get_year]. So I then tried using a command btn and putting your expression on on-click and it still asks for the parameter values, but thanks for trying AJ
Kellif
I would try tying the combo box to an aggregate (i.e. sum) query with the same data source as that the form is on; but where there is just one field - a calculated expression for the year (i.e. get_year: DatePart("yyyy",[arrival_date]) and no other data fields.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.