Link to home
Start Free TrialLog in
Avatar of ITBenelux
ITBeneluxFlag for Belgium

asked on

Access ADP - Date function today

Experts,

I have a query in my Access ADP project where I want to check a series of dates who are in the future (including if they match today). I can not use now() or getdate() as they will look at the time as well.
If found a T-SQL function, to be able to check on the date only.. but it still does not work

When I use : WHERE     dbo.UserId.Date_removed >= GetDate() the query returns all future dates, but not the one who match today.

thx


SELECT     dbo.UserId.Date_removed FROM dbo.UserId INNER JOIN
                      dbo.Department ON dbo.UserId.Department = dbo.Department.dep_id
WHERE     dbo.UserId.Date_removed >=
(SELECT     DATEADD(dd, DATEDIFF(dd, 0, GetDate()), 0)

Open in new window

Avatar of brejk
brejk
Flag of Poland image

The query should definitely return what you need (future dates including today). I just wonder why are you doing the join here. Cause if you have a foreign key in UserId on Department column, then you should just check if Department is not null I guess:

SELECT     Date_removed
FROM        dbo.UserId
WHERE     Date_removed >= DATEADD(dd,DATEDIFF(dd,0,GETDATE()),0)
AND          Department IS NOT NULL


In Access the date() function should return todays date.
Avatar of Gustav Brock
How about:

WHERE     dbo.UserId.Date_removed >= INT(GetDate())

or:

WHERE     DATEDIFF(dd, dbo.UserId.Date_removed, GetDate()) >= 0

/gustav
WHERE  ((CONVERT(VARCHAR(6), dbo.UserId.Date_removed, 112) >=  ((CONVERT(VARCHAR(6), GetDate(), 112)
ASKER CERTIFIED SOLUTION
Avatar of TextReport
TextReport
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ITBenelux

ASKER

I tested all proposed solutions.. yours worked ... thx