I have a Query that I would like to call up the year as either ODD or EVEN without having to put the specific year in the Query e.g.(1992; 1994; 1996; or 1997; 1999; 2001 etc.). Could this be done at runtime?
It is certainly possible to determine whether a year (or any other number) is odd or even within a query, but in order to do this, you need to know what the year is.
Setting up a custom query field such as this will do:
Expr1: Iif(Year(Datefield) Mod 2 = 0, "Even", "Odd"
What this does is takes the remainder of dividing it by 2; if it is 0 it prints "Even" otherwise it prints "Odd".
You will need to change "Datefield" to the name of the date field within your table.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.