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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date Add Query confusing



 
 
Thread Tools Display Modes
  #1  
Old February 15th, 2006, 12:01 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Date Add Query confusing

PERCENT:
IIf(Now()DateAdd("yyyy",+1,[HPDATE]),"4%",IIf(Now()DateAdd("yyyy",+2,[HpDate]),"5%",Null))

2PERCENT:IIF(NOW()DATEADD("YYYY"+7,
[HPDATE]),"7%",IIF(NOW()DATEADD("YYYY",+15, [HPDATE]),"9%",NULL))

Can anyone please explain to me the difference in these two lines. The
first one runs fine, the second tells me it wrong and will not work. I had
them combined but it still would not run and kept getting hung on the +7. I
cannot see what I have done wrong but I am sure it's something simple. Thanks


  #2  
Old February 15th, 2006, 02:19 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Date Add Query confusing

On Tue, 14 Feb 2006 16:01:16 -0800, Akrt48
wrote:

PERCENT:
IIf(Now()DateAdd("yyyy",+1,[HPDATE]),"4%",IIf(Now()DateAdd("yyyy",+2,[HpDate]),"5%",Null))

2PERCENT:IIF(NOW()DATEADD("YYYY"+7,
[HPDATE]),"7%",IIF(NOW()DATEADD("YYYY",+15, [HPDATE]),"9%",NULL))

Can anyone please explain to me the difference in these two lines. The
first one runs fine, the second tells me it wrong and will not work. I had
them combined but it still would not run and kept getting hung on the +7. I
cannot see what I have done wrong but I am sure it's something simple. Thanks


The first has a comma between "yyyy" and +1. The second does not have
the (required) comma between "YYYY" and +7.

Note that you can leave the + off; it's not needed, since +7 and 7 are
the same number. Also, Now() is NOT today's date; it's the current
date and time accurate to microseconds. You might want to use Date()
instead.

John W. Vinson[MVP]
  #3  
Old February 16th, 2006, 03:46 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Date Add Query confusing

Thank you knew it had to be something simple.

"John Vinson" wrote:

On Tue, 14 Feb 2006 16:01:16 -0800, Akrt48
wrote:

PERCENT:
IIf(Now()DateAdd("yyyy",+1,[HPDATE]),"4%",IIf(Now()DateAdd("yyyy",+2,[HpDate]),"5%",Null))

2PERCENT:IIF(NOW()DATEADD("YYYY"+7,
[HPDATE]),"7%",IIF(NOW()DATEADD("YYYY",+15, [HPDATE]),"9%",NULL))

Can anyone please explain to me the difference in these two lines. The
first one runs fine, the second tells me it wrong and will not work. I had
them combined but it still would not run and kept getting hung on the +7. I
cannot see what I have done wrong but I am sure it's something simple. Thanks


The first has a comma between "yyyy" and +1. The second does not have
the (required) comma between "YYYY" and +7.

Note that you can leave the + off; it's not needed, since +7 and 7 are
the same number. Also, Now() is NOT today's date; it's the current
date and time accurate to microseconds. You might want to use Date()
instead.

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Toolbars, Drop-Down Menus Rick New Users 1 September 21st, 2005 11:17 AM
Help again from Ken Snell (Query) Randy Running & Setting Up Queries 22 August 29th, 2005 08:15 PM
Reports with Date Range - Errors jwr Setting Up & Running Reports 12 August 8th, 2005 12:57 PM
Still Hoping for help with a Query problem Don Sealer Using Forms 15 November 13th, 2004 06:24 AM
Here's a shocker Mike Labosh General Discussion 2 October 26th, 2004 05:04 PM


All times are GMT +1. The time now is 02:23 AM.


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