Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Sorry, an Access question

Author  Topic 

Steve2106
Posting Yak Master

183 Posts

Posted - 2013-10-18 : 10:07:09
Please forgive my post here but I have asked on some Access forums and no one replies.
I have always got at least a reply from this forum so thought I would ask here.
I am using an MS Sql Server database for my backend.
In the Access query designer I need to add a criteria on a DateTime field that says if today's date = that of entry date, display the record.
In my field "EntryDate" I have the value "18/10/2013 07:47:26"
What should I enter in the criteria field because if I enter Date(), it does not work.

Thanks for your help.

All the best,



Steve

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-10-18 : 10:31:20
Let's take Access out of the equation because your backend is sql server. Sounds like your data contains datetime values and you need to query for a range of datetimes covering a 24 hour period (today 12:00:00 AM through today 11:59:59 PM)

not sure how to generate this code using access but for sql:
where [EntryDate] >= dateadd(day, datediff(day, 0, getdate()), 0) --today 12:00 AM
and [EntryDate] < dateadd(day, datediff(day, 0, getdate()), 1) --tomorrow 12:00 AM

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -