sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Wayne's Avatar

Problem With IIf Statement


Question posted by: Wayne (Guest) on July 18th, 2006 12:45 AM
I'm using the following IIf statement as the control source for a text
box on a report.

=IIf([WOnumber]=0,"",[WOnumber])

It works fine if "WOnumber" is numeric but gives an error if "WOnumber"
is alphanumeric. I don't understand this. If anyone can suggest a
fix, it would be appreciated.

3 Answers Posted
fredg's Avatar
Guest - n/a Posts
#2: Re: Problem With IIf Statement

On 17 Jul 2006 16:47:17 -0700, Wayne wrote:
Quote:
Originally Posted by
I'm using the following IIf statement as the control source for a text
box on a report.
>
=IIf([WOnumber]=0,"",[WOnumber])
>
It works fine if "WOnumber" is numeric but gives an error if "WOnumber"
is alphanumeric. I don't understand this. If anyone can suggest a
fix, it would be appreciated.


If the field can be alphanumeric, then it is a Text datatype field,
not a Number datatype.

=IIf([WOnumber]="0","",[WOnumber])

Also, make sure the name of the control is not WOnumber.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Randy Harris's Avatar
Guest - n/a Posts
#3: Re: Problem With IIf Statement

* Wayne:
Quote:
Originally Posted by
I'm using the following IIf statement as the control source for a text
box on a report.
>
=IIf([WOnumber]=0,"",[WOnumber])
>
It works fine if "WOnumber" is numeric but gives an error if "WOnumber"
is alphanumeric. I don't understand this. If anyone can suggest a
fix, it would be appreciated.
>


Probably this. You're comparing WOnumber to a number (0) which tells
Access to convert to a number. If it's alpha data, it can't. Obviously
it's not a numeric field. Are you actually storing a 0 in it?

If so, try:
=IIf([WOnumber]="0","",[WOnumber])

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Wayne's Avatar
Guest - n/a Posts
#4: Re: Problem With IIf Statement

Thanks folks. I thought it would be something simple.

 
Not the answer you were looking for? Post your question . . .
196,989 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,989 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors