query usung datedif function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is the sql view of a query that selects records greater than [enter
days] number of days from today. It returns records more than [enter days]
number of days from today but also returns records that are single digit
(1-9)days from today.

SELECT tblPayables.*, tblPayables.paid, DateDiff("d",[invoiceDate],Date())
AS Expr1, [enter days] AS Expr2
FROM tblPayables
WHERE (((tblPayables.paid)=No) AND
((DateDiff("d",[invoiceDate],Date()))>[enter days])) OR
(((tblPayables.paid)=No) AND (([enter days]) Is Null));
 
try

SELECT tblPayables.* FROM tblPayables
WHERE tblPayables.paid=No AND (tblPayables.invoiceDate > Date()+[enter days]
OR [enter days] Is Null;

hth
 
Back
Top