473,396 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Incorrect Expression

166 100+
Hello:

I would like to automatically calculate the time an employees' benefits will begin, which is 90 days after the hire date. I have this expression:
Expand|Select|Wrap|Line Numbers
  1. =IIf(IsNull([HireDt]),Null,IIf(Day([HireDt]+90)=1,[HireDt]+90,DateSerial(Year([HireDt]+90),Month([HireDt]+90)+1,1)))
It does not produce the correct results.

For example: I have a hire date 1/4/2005...it says the benefits start 5/1/05, as opposed to 4/4/05.

What's wrong with my expression?
Feb 13 '09 #1
13 1409
NeoPa
32,556 Expert Mod 16PB
As a quick response - I would say consider using DateAdd().
Feb 13 '09 #2
csolomon
166 100+
Thanks! that worked great
Feb 13 '09 #3
DonRayner
489 Expert 256MB
Try it like this.
Expand|Select|Wrap|Line Numbers
  1. =IIf(IsNull([HireDt]),Null,DateAdd("d",90,[HireDt])
Never Mind. NeoPa answerd it.
Feb 13 '09 #4
csolomon
166 100+
Actually, I ended up using just what you suggested, except I incremented by the month as opposed to the day.

thanks Don!
Feb 13 '09 #5
NeoPa
32,556 Expert Mod 16PB
You say you want to add 90 days, yet your code doesn't do this. Assuming you want to return Null if [HireDt] is null, try :
Expand|Select|Wrap|Line Numbers
  1. =[HireDt]+90
or
Expand|Select|Wrap|Line Numbers
  1. =DateAdd("d",90,[HireDt])
The Null should perpetuate anyway.

PS. Please note the edit comment by your post. This is not optional. As a full member we expect you to follow the site rules.
Feb 13 '09 #6
csolomon
166 100+
"PS. Please note the edit comment by your post. This is not optional. As a full member we expect you to follow the site rules. "

I note it, but as a full member, I've never known how to do this...it would have been helpful if you had said how to do this.
Feb 13 '09 #7
NeoPa
32,556 Expert Mod 16PB
You've been here 11 months and made 91 posts to date, and have never bothered to check out the Help section? Remarkable. All you ask and more is there available for you to read any time.

OK. There is a link to the Help section on every page of this site. If you go there, you will see a section called Posting Guidelines. We expect members to abide by these guidelines, but will always issue a warning (with direct links) before taking any punitive action. I'm sure you can appreciate that taking every member through them by the hand is not a practical possibility (although I've never seen any of the moderators fail to be very helpful when asked).

Particularly, for ensuring you use the [ CODE ] tags, there is a toolbar type of thing in the posting window (looks like a hash (#)) which will place the relevant tags around any selected text. Tooltips over each button explains what they do for you.

This is not found in the QuickReply window at the bottom of every thread, nor in the Basic Editor window if you have that selected in your profile. If you choose to use either of these options, then you are responsible for formatting the reply yourself. I can help you to select the other (more fully featured) editor if that is a problem for you.

-Administrator.
Feb 13 '09 #8
csolomon
166 100+
"You've been here 11 months and made 91 posts to date, and have never bothered to check out the Help section?"

--Nope, never needed to...didn't know there was an issue
Expand|Select|Wrap|Line Numbers
  1. Thanks for the link
Feb 16 '09 #9
NeoPa
32,556 Expert Mod 16PB
@csolomon
Yet you don't seem at all embarrassed to post this. You complain something is missing, without even checking to see if it's there. Impressive.
Feb 16 '09 #10
csolomon
166 100+
Actually, a poster edited my work before and asked me to in the future use the tags but I could never figure out how to do it...I thought I had to select something to do it Who know it was as simple as [code]...[\code] so I appreciate your pointing to it...Am I embarrassed, no, just glad I finally know how to do it so that it doesn't irritate anyone else.
Feb 16 '09 #11
NeoPa
32,556 Expert Mod 16PB
You shouldn't need to have to type them out manually though. here's something I just prepared to clarify things.

Tags are done as matching pairs where the opening one is surrounded by [...] and the closing one by [/...]. A set of buttons is available for ease of use in the Standard Editor (Not the Basic Editor). The one for the [ CODE ] tags has a hash (#) on it. You can choose which editor to use in your profile options (Look near the bottom of the page).
Feb 16 '09 #12
csolomon
166 100+
Expand|Select|Wrap|Line Numbers
  1. AHHHHHHHHHHH...
  2. So I found the hash and I made some changes to my profile...
  3. which I never paid attention to before...
  4. I just started asking for help!
  5. Thank you for getting me on track.
Feb 16 '09 #13
NeoPa
32,556 Expert Mod 16PB
That's fine. When I realised what you needed to know I was happy to help.
Feb 16 '09 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Michelle Hillard | last post by:
Hi guys, would appreciate if you can shed some light on this. Sorry to be a pain, can you tell me what is wrong with the following: for /F %%i in ('dir /b /on c:\bcp\pc*.txt') do bcp...
5
by: Pat L | last post by:
I have a function that is designed to return a variable that contains concatenated values from a partinular field in the returned rows: DECLARE @output varchar(8000) SELECT @output = CASE...
13
by: NM | last post by:
Sometimes ago I was having a problem in linking between C++ and Fortran program. That was solved (using input from this newsgroup) using the Fortran keyword "sequence" with the derived types (to...
13
by: Yogesh Khanolkar | last post by:
Hi, I am getting incorrect o/p from the code below: #include<stdio.h> #include<float.h> #include<limits.h> main() { double val,val1;
43
by: Dave Vandervies | last post by:
Seen in a chunk of code I was looking at recently (not mine!): -------- char* imgfilename; sprintf((char*)imgfilename, "mask%d.dib", params.profile); ReadImage((char*)imgfilename); --------...
0
by: Alex Sedow | last post by:
Look at example: namespace N { class A { public void v() {}} class B : A { new public const int v = 10; } class C : B { new public void v ( int a ) {}} class D : C { delegate void fun();
1
by: Eric Newton | last post by:
Given the following code, Public class ProgressFormManager Public Sub BeginInvoke(ByVal method As , ByVal args() As Object) Dim asyncCallback As New System.Threading.WaitCallback(method)...
2
by: xfx | last post by:
Please consider this code: ---------- Dim i As Decimal Dim p As Decimal = 31D i = (2D ^ (p - 1D)) * (2D ^ p - 1D) ----------
3
by: Don Burden | last post by:
We've started converting some applications to the .NET 2.0 framework. When compiling in VS 2005, I'm getting a warning on this line: return (unitWidth != null ) ? unitWidth : new Unit("0px"); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.