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  

#Error in date field



 
 
Thread Tools Display Modes
  #1  
Old September 24th, 2005, 07:24 PM
Kushum
external usenet poster
 
Posts: n/a
Default #Error in date field

Hi everyone,

I would be grateful if someone could tell me how to handle errors in
queries. The problem is that I am using DateAdd function to add up a number
to the date so for eg:
DateCleared = 12/01/2004
Length_of_Level = 2
So i have used the following:
Date Renewal: DateAdd("yyyy",[Length_of_ Level],[DateCleared])-1
The formula adds up the date and substracts one day...so the final result
would be 11/01/2006 and it works fine.
But if either the dateCleared or Length_of_Level is missing it results in
#Error in the field but I want it to be blank and not say anything in the
field if such information is missing.
Please bear in mind that I don't want to use VBA code as i'm still a
beginner and not too good with VB code and therefore appreciate it if you can
help me with it in Query itself.
Thanks in advance



  #2  
Old September 24th, 2005, 09:00 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default

Try something like:
Date Renewal: IIf(IsNull([Length_of_ Level]+[DateCleared]), Null,
DateAdd("yyyy",[Length_of_ Level],[DateCleared])-1)


--
Duane Hookom
MS Access MVP


"Kushum" wrote in message
...
Hi everyone,

I would be grateful if someone could tell me how to handle errors in
queries. The problem is that I am using DateAdd function to add up a
number
to the date so for eg:
DateCleared = 12/01/2004
Length_of_Level = 2
So i have used the following:
Date Renewal: DateAdd("yyyy",[Length_of_ Level],[DateCleared])-1
The formula adds up the date and substracts one day...so the final result
would be 11/01/2006 and it works fine.
But if either the dateCleared or Length_of_Level is missing it results in
#Error in the field but I want it to be blank and not say anything in the
field if such information is missing.
Please bear in mind that I don't want to use VBA code as i'm still a
beginner and not too good with VB code and therefore appreciate it if you
can
help me with it in Query itself.
Thanks in advance





  #3  
Old September 25th, 2005, 12:07 AM
Kushum
external usenet poster
 
Posts: n/a
Default

Hi Duane,
Thankyou so much for your help I appreciate it...it works fine..

"Duane Hookom" wrote:

Try something like:
Date Renewal: IIf(IsNull([Length_of_ Level]+[DateCleared]), Null,
DateAdd("yyyy",[Length_of_ Level],[DateCleared])-1)


--
Duane Hookom
MS Access MVP


"Kushum" wrote in message
...
Hi everyone,

I would be grateful if someone could tell me how to handle errors in
queries. The problem is that I am using DateAdd function to add up a
number
to the date so for eg:
DateCleared = 12/01/2004
Length_of_Level = 2
So i have used the following:
Date Renewal: DateAdd("yyyy",[Length_of_ Level],[DateCleared])-1
The formula adds up the date and substracts one day...so the final result
would be 11/01/2006 and it works fine.
But if either the dateCleared or Length_of_Level is missing it results in
#Error in the field but I want it to be blank and not say anything in the
field if such information is missing.
Please bear in mind that I don't want to use VBA code as i'm still a
beginner and not too good with VB code and therefore appreciate it if you
can
help me with it in Query itself.
Thanks in advance






 




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
Import date field problem. Thief_ General Discussion 1 July 18th, 2005 10:11 AM
date ranges from a calculated date field John Feeley Running & Setting Up Queries 1 May 26th, 2005 06:53 AM
Rowsource of Field List Mark Using Forms 5 December 20th, 2004 12:42 AM
How do I set up a report using dates as my report header? Robin Setting Up & Running Reports 16 November 13th, 2004 01:00 PM
Filtering on custom date field MED Contacts 3 September 17th, 2004 03:05 PM


All times are GMT +1. The time now is 07:36 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.