473,396 Members | 1,921 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.

IIF acting funny

I have a field in an Access XP report that contains the following line as its
control source:

=IIf([Education_Comp_DATE]="1/1/1900" Or [Education_Comp_DATE]="12/31/2100"
Or CheckEmpty([Education_Comp_DATE]),"N/A",[Education_Comp_DATE])

Note:CheckEmpty is a function I created to check if a field is blank or null.
It returns a boolean.

On some PCs, it calculates correctly and on others, it doesn't and when I say
it doesn't calculate correctly, i mean that it shows 1/1/1900 when it should
be showing N/A. What would cause an IIF to calculate differently on
different PCs? The references on both PCs are the same. I am out of ideas.
Help!!
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200509/1
Nov 13 '05 #1
8 1595
Could be a problem with date formatting -- different settings on different
machines.

See this page on formatting dates:

http://mvps.org/access/datetime/date0005.htm

"Norm C via AccessMonster.com" <u8613@uwe> wrote in message
news:552909eb30049@uwe...
I have a field in an Access XP report that contains the following line as
its
control source:

=IIf([Education_Comp_DATE]="1/1/1900" Or
[Education_Comp_DATE]="12/31/2100"
Or CheckEmpty([Education_Comp_DATE]),"N/A",[Education_Comp_DATE])

Note:CheckEmpty is a function I created to check if a field is blank or
null.
It returns a boolean.

On some PCs, it calculates correctly and on others, it doesn't and when I
say
it doesn't calculate correctly, i mean that it shows 1/1/1900 when it
should
be showing N/A. What would cause an IIF to calculate differently on
different PCs? The references on both PCs are the same. I am out of
ideas.
Help!!
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200509/1

Nov 13 '05 #2
Is the type of [Education_Comp_DATE ] Date?
If so, on some computers, "1/1/1900" might be coreced to a date, and
result in [Education_Comp_DATE]="1/1/1900" returning True while on
others, it might not be coerced, or coerced in some unforeseen way,
resulting in [Education_Comp_DATE]="1/1/1900" returning False.

This could depend on local settings.

If ths is so, you might cure the problem with
[Education_Comp_DATE]=DateSerial(1900,1,1)

Nov 13 '05 #3
On Fri, 30 Sep 2005 23:26:40 GMT, Norm C via AccessMonster.com wrote:
I have a field in an Access XP report that contains the following line as its
control source:

=IIf([Education_Comp_DATE]="1/1/1900" Or [Education_Comp_DATE]="12/31/2100"
Or CheckEmpty([Education_Comp_DATE]),"N/A",[Education_Comp_DATE])

Note:CheckEmpty is a function I created to check if a field is blank or null.
It returns a boolean.

On some PCs, it calculates correctly and on others, it doesn't and when I say
it doesn't calculate correctly, i mean that it shows 1/1/1900 when it should
be showing N/A. What would cause an IIF to calculate differently on
different PCs? The references on both PCs are the same. I am out of ideas.
Help!!


Several points to consider.
1) You have written your code as if the criteria "1/1/1900" is a
string value.
Isn't [Education_Comp_DATE] a Date Datatype field?
Then you need to surround your date criteria with the date delimiter
#.

=IIf([Education_Comp_DATE] = #1/1/1900# Or [Education_Comp_DATE] =
#12/31/2100# Or CheckEmpty([Education_Comp_DATE]), "N/A",
[Education_Comp_DATE])

You could make it a bit easier

2) =IIf([Education_Comp_DATE] = 2 Or [Education_Comp_DATE] = 73415 Or
CheckEmpty([Education_Comp_DATE]), "N/A", [Education_Comp_DATE])

The numbers are the actual stored values for the dates you chose.

3) Also what does CheckEmpty([Education_Comp_DATE]) return, as there
is no field here using it as criteria, so the actual expression will
read

=IIf([Education_Comp_DATE] = 2 Or [Education_Comp_DATE] = 73415 Or
True, "N/A", [Education_Comp_DATE])
which doesn't make sense.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 13 '05 #4
On 30 Sep 2005 17:07:03 -0700, "lylefair" <ly******@yahoo.ca> wrote:
Is the type of [Education_Comp_DATE ] Date?
If so, on some computers, "1/1/1900" might be coreced to a date, and
result in [Education_Comp_DATE]="1/1/1900" returning True while on
others, it might not be coerced, or coerced in some unforeseen way,
resulting in [Education_Comp_DATE]="1/1/1900" returning False.

This could depend on local settings.

If ths is so, you might cure the problem with
[Education_Comp_DATE]=DateSerial(1900,1,1)


Or [Education_Comp_DATE]=CVDate("Jan 1, 1900")

I've been leaning towards this style lately because it's both a deterministic
format, and one I don't have to slow down to read when I'm skimming through
the app.
Nov 13 '05 #5
I thought dates had to be enclosed in Hashes
#12/31/2100#, not inverted commas "12/31/2100"

Phil

"Norm C via AccessMonster.com" <u8613@uwe> wrote in message
news:552909eb30049@uwe...
I have a field in an Access XP report that contains the following line as
its
control source:

=IIf([Education_Comp_DATE]="1/1/1900" Or
[Education_Comp_DATE]="12/31/2100"
Or CheckEmpty([Education_Comp_DATE]),"N/A",[Education_Comp_DATE])

Note:CheckEmpty is a function I created to check if a field is blank or
null.
It returns a boolean.

On some PCs, it calculates correctly and on others, it doesn't and when I
say
it doesn't calculate correctly, i mean that it shows 1/1/1900 when it
should
be showing N/A. What would cause an IIF to calculate differently on
different PCs? The references on both PCs are the same. I am out of
ideas.
Help!!
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200509/1

Nov 13 '05 #6
On 30 Sep 2005 17:07:03 -0700, "lylefair" <ly******@yahoo.ca> wrote:

Sounds a lot like some of the bugs that exist in oleauth.dll (which is
used for date math). MSFT has known about this for YEARS but refuses
to fix them.

-Tom.

Is the type of [Education_Comp_DATE ] Date?
If so, on some computers, "1/1/1900" might be coreced to a date, and
result in [Education_Comp_DATE]="1/1/1900" returning True while on
others, it might not be coerced, or coerced in some unforeseen way,
resulting in [Education_Comp_DATE]="1/1/1900" returning False.

This could depend on local settings.

If ths is so, you might cure the problem with
[Education_Comp_DATE]=DateSerial(1900,1,1)


Nov 13 '05 #7
You and Phil Stanton were correct in that my dates were suppose to be
enclosed in hashes. Also, regarding how my CheckEmpty function doesn't make
sense, since it returns a Boolean, you really don't need a variable using it.
Basically, the function CheckEmpty is actually its own variable that will
result in TRUE or FALSE.

fredg wrote:
I have a field in an Access XP report that contains the following line as its
control source:

[quoted text clipped - 10 lines]
different PCs? The references on both PCs are the same. I am out of ideas.
Help!!


Several points to consider.
1) You have written your code as if the criteria "1/1/1900" is a
string value.
Isn't [Education_Comp_DATE] a Date Datatype field?
Then you need to surround your date criteria with the date delimiter
#.

=IIf([Education_Comp_DATE] = #1/1/1900# Or [Education_Comp_DATE] =
#12/31/2100# Or CheckEmpty([Education_Comp_DATE]), "N/A",
[Education_Comp_DATE])

You could make it a bit easier

2) =IIf([Education_Comp_DATE] = 2 Or [Education_Comp_DATE] = 73415 Or
CheckEmpty([Education_Comp_DATE]), "N/A", [Education_Comp_DATE])

The numbers are the actual stored values for the dates you chose.

3) Also what does CheckEmpty([Education_Comp_DATE]) return, as there
is no field here using it as criteria, so the actual expression will
read

=IIf([Education_Comp_DATE] = 2 Or [Education_Comp_DATE] = 73415 Or
True, "N/A", [Education_Comp_DATE])
which doesn't make sense.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200510/1
Nov 13 '05 #8
Note that the reason the value needs to be un hashes is because you want to be
comparing dates, not converting the date to a string and comparing strings.
Using hashes is not the most reliable way to do that, though. I'd use
DateSerial or CVDate with a date string to make the date value.

On Wed, 05 Oct 2005 14:50:13 GMT, "Norm C via AccessMonster.com" <u8613@uwe>
wrote:
You and Phil Stanton were correct in that my dates were suppose to be
enclosed in hashes. Also, regarding how my CheckEmpty function doesn't make
sense, since it returns a Boolean, you really don't need a variable using it.
Basically, the function CheckEmpty is actually its own variable that will
result in TRUE or FALSE.

fredg wrote:
I have a field in an Access XP report that contains the following line as its
control source:

[quoted text clipped - 10 lines]
different PCs? The references on both PCs are the same. I am out of ideas.
Help!!


Several points to consider.
1) You have written your code as if the criteria "1/1/1900" is a
string value.
Isn't [Education_Comp_DATE] a Date Datatype field?
Then you need to surround your date criteria with the date delimiter
#.

=IIf([Education_Comp_DATE] = #1/1/1900# Or [Education_Comp_DATE] =
#12/31/2100# Or CheckEmpty([Education_Comp_DATE]), "N/A",
[Education_Comp_DATE])

You could make it a bit easier

2) =IIf([Education_Comp_DATE] = 2 Or [Education_Comp_DATE] = 73415 Or
CheckEmpty([Education_Comp_DATE]), "N/A", [Education_Comp_DATE])

The numbers are the actual stored values for the dates you chose.

3) Also what does CheckEmpty([Education_Comp_DATE]) return, as there
is no field here using it as criteria, so the actual expression will
read

=IIf([Education_Comp_DATE] = 2 Or [Education_Comp_DATE] = 73415 Or
True, "N/A", [Education_Comp_DATE])
which doesn't make sense.


Nov 13 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
8
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
4
by: Will Stuyvesant | last post by:
Add your funny or surprising Python error messages to this thread. A requirement is that you should also show (minimal) code that produces the message. Put the code below, so people can think...
0
by: bugbear | last post by:
I was struggling with some elaborate nested divs, and my styles were working fine on everything (even Mac/ie5.2) *except* IE6.0 on Windows 2000 professional. I have 2 nested DIVS, both...
5
by: eScrewDotCom | last post by:
www.eScrew.com eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is...
3
by: Jason | last post by:
I have two applications that I wrote that use asp and javascript source files. Recently both of these applications starting acting strange on my test box. Image icons will randomly stop showing...
8
by: MarsFossils | last post by:
I am giving a lunch and learn talk on how to "Create your own Web Page" tomorrow and would like to mention a funny anecdote with an inspiring moral about web page design. Does anybody have any...
0
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
4
by: jason.teen | last post by:
Hi, when i am joining on a Column of Text Type with one of Memo type the resulting entry has funny chinese characters! Has anyone else encountered this before? Is there a cure?? Cheers.
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.