Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding two fields together in a form

Status
Not open for further replies.

Fortborg

Technical User
Jul 26, 2001
15
0
0
US
I'm betting there is an easy way to do this and I'm just not seeing it, but its held me back for two days now, so I seek advice.

What we needed is a form, made-up all pretty with all the bells and whistles, that the user will fill out then just hit a control button to print the thing and send it out to the contractor.

The problem area of the form looks roughly like:

Description|Invoice Number|Amount
Description 2|Invoice 2|Amount 2
Total:

What I need, is to get Amount and Amount 2 to add together in the Total field. There are 7 Amounts in all, Amount; Amount 2; Amount 3; Amount 4; Amount 5; Amount 6; & Amount 7.

Let's say the value in "Amount" is 10, and the value in "Amount 2" is 10.

When I enter =[Amount]+[Amount 2] in the Control Source field of the Total text box, Rather then getting "20" I get "1010".

I'm an idiot, and dangerously close to deadline, please help. Thank you.

Fort N'zur
 
Fort,

You have to convert the strings to integers. Use
Code:
  = CInt[Amount]+ CInt[Amount 2]


HTH John

Use what you have,
Learn what you can,
Create what you need.
 
Hi Fort,

Check the "Type" property of the field in the underlying field. It is probably set to text. It needs to be "Number" and probably integer or long depending on your needs.

Best regards,

Henr¥
 
Thanks John and Henry, as soon as I read Integer I was slapping my forehead! Now to explain to my boss why the project it three days behind...and what I was using that extra time for. LOL

Saved my bacon, thanks again.

Fort N'zur
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top