View Full Version : Criteria in a query


Pos
01-16-2002, 01:45 PM
Hi all,

I have enter an expression in the field of an expression

Visual Next Service Date: DateAdd("m",[frequency],[LastServiceDate])

When i enter a date calculation..<DateAdd("m",0,Date()).. in the criteria i get an error message.. works fine in access 2002 but i need it in 97


any top tip as to if it can be done in 97 and if so how

Cheers Pos,

raskew
01-17-2002, 05:34 AM
Tried your example in 97 and it ran without problem. Suspect there's something else going on. As a test, copy/paste the following into a new query in Northwind. You should be able to run it, and modify the number of months.

SELECT Orders.OrderID, Orders.OrderDate
FROM Orders
WHERE (((Orders.OrderDate)<DateAdd("m",-72,Date())));

Pos
01-17-2002, 11:41 AM
Hi,

Just of a matter of interest if you have a gap in any part of the field expression would this cause the criteria expression not to work. This is the full expression in the field of the query,

ie Visual Next Service Date: DateAdd("m",[Formal visual frequency],[Formal Visual LastServiceDate])

and in the criteria in the query

ie <DateAdd("m",0,Date())

Cheers Pos,

Rich
01-17-2002, 12:42 PM
Try <DateAdd("m",0,Now())

Pos
01-17-2002, 01:28 PM
hi..

Will let you know

Pos,