MS Access - Check for #Error in calculation

Posted on 2008-11-19
Last Modified: 2013-11-27
I'm doing some math  ##/##
I don't want #Error in the results of the qry
If the ressult is #Error I want the the result to be set to NULL

How would I do this within a select
Question by:keschuster
    LVL 84

    Accepted Solution

    I'm assuming this is a divide-by-zero error? You didn't mention exactly what error you think it may be, so I'm assuming the standard.

    You can use IIF:

    YourCalculatedField: IIF(SomeField=0, Null, OtherField/SomeField)

    Author Comment

    I resolved this by making the join a bit smarter by checking for null on the join instead of letting access tell me it was an error.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article is a continuation or rather an extension from Cascading Combos ( and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now