• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

Help me overcome overflow error


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!!
  • 2
  • 2
1 Solution
ukkrewAuthor Commented:
Ah, don't worry about this question... i fixed it by adding validation to the field:


Question solved :P
Jonathan KellyCommented:
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

ukkrewAuthor Commented:
ah, you've gone and put some input in... I'll award it to you anyway :)
Jonathan KellyCommented:
thanks for the points.

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now