Connecting Tech Pros Worldwide Help | Site Map

Problem With IIf Statement

  #1  
Old July 18th, 2006, 12:45 AM
Wayne
Guest
 
Posts: n/a
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.

  #2  
Old July 18th, 2006, 01:15 AM
fredg
Guest
 
Posts: n/a

re: Problem With IIf Statement


On 17 Jul 2006 16:47:17 -0700, Wayne wrote:
Quote:
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
  #3  
Old July 18th, 2006, 01:35 AM
Randy Harris
Guest
 
Posts: n/a

re: Problem With IIf Statement


* Wayne:
Quote:
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.
  #4  
Old July 18th, 2006, 02:15 AM
Wayne
Guest
 
Posts: n/a

re: Problem With IIf Statement


Thanks folks. I thought it would be something simple.

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ignore blank search parameter with IIf statement power2005 answers 5 April 16th, 2009 05:25 PM
Is there a problem with IIF or am I doing something wrong? Charles May answers 3 November 22nd, 2005 07:14 AM
Problem with IIf statement in the OR clause Andy_Khosravi@bcbsmn.com answers 3 November 13th, 2005 03:27 PM
Is there a problem with IIF or am I doing something wrong? Charles May answers 3 July 21st, 2005 12:20 PM