A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Subtract Now() - 6 months



 
 
Thread Tools Display Modes
  #1  
Old February 20th, 2007, 10:45 PM posted to microsoft.public.access.queries
Tony Ramirez
external usenet poster
 
Posts: 26
Default Subtract Now() - 6 months

Help please. Would like to take Expr2: Now() - Value

Value would be 6 for six months.

Like the result written in regular Date Time.

Thanks,

Tony
  #2  
Old February 20th, 2007, 10:55 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Subtract Now() - 6 months

Use the DateAdd function

DateAdd("m",-6,Date())

will give you the date six months prior to today's date.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Tony Ramirez" wrote in message
...
Help please. Would like to take Expr2: Now() - Value

Value would be 6 for six months.

Like the result written in regular Date Time.

Thanks,

Tony



  #3  
Old February 20th, 2007, 11:17 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Subtract Now() - 6 months

On Tue, 20 Feb 2007 13:45:13 -0800, Tony Ramirez
wrote:

Help please. Would like to take Expr2: Now() - Value

Value would be 6 for six months.

Like the result written in regular Date Time.

Thanks,

Tony


The DateAdd() function will do this for you:

DateAdd("m", -[Value], Date())

I'd use Date() rather than Now() because Now() returns the current
date and time, accurate to a few microseconds; you probably don't need
that level of precision for six months ago!

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.