Help me overcome overflow error

Posted on 2006-05-05
Last Modified: 2008-02-01

I'm creating a form with some basic maths on it, but it keeps causing overflow errors... i know a work around... but it means the form has to lose some functionality.

There are 4 fields...

Total(Text169), Actual(Text171), Special1(Text161), Special2(Text164)

The following is used to create a string which is put into a label(Label166)... i.e.

Label166.Caption = "= " & (Text171 + Text161 + Text164) & " (" & Fix((Text171 + Text161 + Text164) / Text169 * 100) & "%)"

Now thats all well and good... here is the problem...

1) When the form starts I want to populate all fields with "0" and set the label to "= (NA%)" which i have successfully done
2) When a user updates any of the 4 fields I want the calculation to be run, except where total = 0 (as you can't divide by 0)
3) When total = 0, Label = "= [total] (NA%)"

Thanks for the help!!
Question by:ukkrew

    Author Comment

    Ah, don't worry about this question... i fixed it by adding validation to the field:


    Question solved :P
    LVL 7

    Accepted Solution

    set the field default values to 0 & NA as needed

    add this function to your form.
    function buildlabel as string
    if Text169 <> 0 then
    buildlabel = "= " & (Text171 + Text161 + Text164) & " (" & Fix((Text171 + Text161 + Text164) / Text169 * 100) & "%)"
    end if

    on the afterupdate of each of your fields add
    label166.caption = buildlabel


    Author Comment

    ah, you've gone and put some input in... I'll award it to you anyway :)
    LVL 7

    Expert Comment

    by:Jonathan Kelly
    thanks for the points.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    The first two articles in this short series — Using a Criteria Form to Filter Records ( and Building a Custom Filter ( — discuss in some detail how a form can be…
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    737 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

    21 Experts available now in Live!

    Get 1:1 Help Now