Results 1 to 5 of 5
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    IsError function not working

    I have a field that contains alpha, numerican and mixed codes. It's been suggested that I filter out all the numeric codes from my query. To test for this I am using a cint() function to convert the value to a number if it is numeric, but this produces an #Error when the value is not numeric. I expected this and planned to get around it by using the IsError function,
    Code:
     IsError(CInt([diagnosiscD]))
    eventually planning on substituting an alternate value via the IIF() function or the error code.

    Code:
     IIf(IsError(Cint([diagnosiscD])),0,IsNumeric(Cint([diagnosiscD])))
    Well, even though it is an error, I still get the #Error code instead a True or False from the IsError function. As long a I have an error code in that field and can Filter for True or False.



    Long story short? Why isn't the IsError function detecting the error? or should I go about this differently?


    p.s. I searched the site for IsError() and a saw a few others had similar problems with IIF(IsError(... scenario, but none of those solutions seemed to apply to my example.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    How about using IsNumeric() to test instead of CInt()?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    I swear I tried that and IsNumeric treated numbers as text, which led me to convert the text to a number and my current dilemma. Now I'm not sure what I did, because this worked just like you would it expect it to. It's tough being a "Lone Ranger".

    Thanks for throwing me a rope.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Does that make me Tonto?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    **Eyeroll**

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 07-15-2015, 01:30 PM
  2. Replies: 3
    Last Post: 01-29-2013, 04:34 AM
  3. Nz function not working
    By Beerman in forum Queries
    Replies: 4
    Last Post: 10-24-2012, 11:46 AM
  4. Replies: 1
    Last Post: 11-17-2011, 12:06 PM
  5. IIf(IsError ... problem ...
    By jacek.w.bak in forum Forms
    Replies: 1
    Last Post: 07-07-2011, 11:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums