Invalid Data When Summing Two Text Box Fields

R

Rick

I have a form I created that allows the user to input currency
information into two text box fields, with a third text box field
being an auto-calculated sum of the two prior text box fields.

I run into an issue when certain numbers are put into the two text box
fields. Sometimes, the text box that sums the fields presents a
validation error. An example:

Text Box 1 Value - $128,897.37
Text Box 2 Value - $11,311.80
Text Box 3 Value (Equation = 'Text Box 1' + 'Text Box 2') -
$140,209.17 *Highlighted and Marked Invalid*

When I change just one of the numbers by a cent, the invalid error
goes away. When I changed the format of Text Box 3 to automatically
set the number of decimal places, I get the following number from the
example above:

Text Box 1 Value - $128,897.37
Text Box 2 Value - $11,311.80
Text Box 3 Value (Equation = 'Text Box 1' + 'Text Box 2') -
$140,209.170000000 *Highlighted and Marked Invalid*

I have no idea where those extra zeros are coming from, but the zeros
go away when I change one of the numbers by just one cent.

I researched the problem and came across this article -
http://blogs.msdn.com/infopath/arch...lculating-the-result-of-2-or-more-fields.aspx.
Unfortunately, their solution didn't work for my situation (when
trying to use the round() function).

Please help...if a form can't do a simple summation calculation, I
don't believe my company can use it. Thank you!!!


Rick
 
S

Steve

Rick,

I created a form with three text box fields.

All fields are set to Decimal (double), Currency, 2 decimal places, and Uses
separator.
Field3's Value is set to "field1 + field2", and the Display tab is set to
Read-only.

This sems to work fine, no erors detected.

I'm using InfoPath 2007 (12.0.6214.1000) SP1 MSO (12.0.6320.5000) on Windows
XP

HTH
 
R

Rick

You did it!

I figured out the problem - the Access database I created had listed
the fields as type currency. When the InfoPath form generated a
floating-point error, the form would indicate an error because the
database would not accept any data greater than two decimal places.
By changing the field type to double, with auto decimal places, and
then setting the form to accept field type currency with 2 decimal
places, it no longer generates any errors.

Thanks for the help!!!


Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top