Error Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to embed an error function in an IIF function, but I can't seem to
get it to work properly. In Excel, I often use a formula like this:

IF(ISERROR(A1*1),"UNKNOWN",A1*1). Essentially, if you're going to give me
an error when I try to do the formula, don't do it. Otherwise, do it.

I'm trying to use a similar expression in Access, but I end up getting
#Error instead of "UNKNOWN." What am I doing wrong? My expression reads:
IIf(IsError(Left([size],1)*1),"UNKNOWN SIZE",[Size])

Thanks in advance for any help you can give me.
 
Jane:

My understanding is that the IsError function works differently in Excel
versus Access. The Access version only tests the value to see if it is an
error value. "Error Value" in this case means a value created with the
CVErr function (see Access Help). So even though they have the same name
the functions work differently, which you have discovered. If by
multiplying by one you are testing for numeracy, you may want to consider
using the IsNumeric function like the following:

IIf(Not IsNumeric(Left([size],1)),"UNKNOWN SIZE",[Size])

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


I'm trying to embed an error function in an IIF function, but I can't seem
to
get it to work properly. In Excel, I often use a formula like this:

IF(ISERROR(A1*1),"UNKNOWN",A1*1). Essentially, if you're going to give me
an error when I try to do the formula, don't do it. Otherwise, do it.

I'm trying to use a similar expression in Access, but I end up getting
#Error instead of "UNKNOWN." What am I doing wrong? My expression reads:
IIf(IsError(Left([size],1)*1),"UNKNOWN SIZE",[Size])

Thanks in advance for any help you can give me.
 
That's exactly what I was trying to do, and the Not IsNumeric works
perfectly. Thanks!
 
Back
Top