|
Question : Access 2000 - Query Crteria Problem
|
|
I have a database with a table containing 4 fields.
[number] - a general number [numberofmonth] - the number of the month (E.g. 3,4,5) [numberofyear] - the number of the year (E.g. 2002,2003) [text] - Names of employees
The table contains records from [numberofmonth]= 4 [numberofyear]= 2002 to [numberofmonth]= 3 [numberofyear]= 2003(My company's ficsal year)
I am trying to SUM the [number] field in a query starting from the start of the fiscal year(4,2002) to the current date - I have a form that I refer to in this query that has a field showing the current date.
I tried to enter the following criteria in the [numberofmonth] field.
>=4 and <=Datepart("m",[forms]![Monthly Reports]![ThisMonth])
This works fine until
Datepart("m",[forms]![Monthly Reports]![ThisMonth]) = 1 or 2 or 3
I've tried using IFF statments, but just couldn't get it to work. Basically if Datepart("m",[forms]![Monthly Reports]![ThisMonth]) = 2 I want to see the records where the [number] field equals 4 thru 12 and also 1 and 2, but not 3 until it is March.
I hope that makes sense.
Max
|
|
Answer : Access 2000 - Query Crteria Problem
|
|
I would approach this by concatenating the Year and Month and set the criteria to compare to this new field. eg. 200212 .. 200301 QYM: (numberofyear * 100) + numberofmonth
|
|
|
|