Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2006, 11:27 AM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Syntax of date function in MS Access

hi guys,

I have a field name DateEntered in an Access table.

I need to get all the current date - 1 records from that table.

cud anyone let me know the syntax for that query.

I tried in this way but cudn't get the records

SELECT[Traffic Accidents].[Date Entered]
FROM [Traffic Accidents]
WHERE [Traffic Accidents].[Date Entered] = Now -1;

Krish Reddy
 
Old July 20th, 2006, 09:36 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now returns the time as well as the date. I believe what you want is DatePart(Now) - 1.

 
Old July 21st, 2006, 09:27 AM
Authorized User
 
Join Date: Apr 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the syntax on the datepart is +datepart("d",now())-1 where you want to return the specific day.

"m" for month
"y" for year etc.

 
Old July 25th, 2006, 03:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

"SELECT [Traffic Accidents].[Date Entered]
FROM [Traffic Accidents]
WHERE [Traffic Accidents].[Date Entered] = #" & DateAdd("d", -1, Date()) & "#"


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access VBA Dateddiff Function SKZ Access VBA 5 November 18th, 2008 08:38 AM
Calling MS Access vba function via Excel Kourosha Excel VBA 0 December 31st, 2007 08:33 AM
Create Trigger,Procedure, Function in MS-Access.? navneet_chauhan10 SQL Language 1 December 27th, 2007 09:33 AM
Syntax to query Date/Time in MS ACCESS chiuyianl Access 4 March 31st, 2005 09:08 AM
Instring function in ms access vishnushankar Access 2 December 24th, 2004 02:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.