Simple: Adding Two Fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have three fields on a form FrmTotal;
txt_issue, txt_pending and txt_total;
Now what I want is when the user enters the values in the fields txt_issue and txt_pending, I want to calculate the sum of the two fields and display in the field txt_total; I am using the lost focus property of txt_pending for thi
I tried writing the code, but the result I keep getting for 22 + 22 = 2222 and not 44. Please help
 
If these are unbound text boxes, set the Format property to:
General Number
or similar so that Access knows they are numbers.

While you could use the AfterUpdate of both text boxes to write the result
to the 3rd, you could also set the Control Source of the 3rd box to:
=[txt_issue] + [txt_pending]

If they are text boxes that are bound to a field, open your table in design
view, and change the Data Type of these columns from Text to Numeric.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Sahil said:
I have three fields on a form FrmTotal;
txt_issue, txt_pending and txt_total;
Now what I want is when the user enters the values in the fields txt_issue
and txt_pending, I want to calculate the sum of the two fields and display
in the field txt_total; I am using the lost focus property of txt_pending
for this
I tried writing the code, but the result I keep getting for 22 + 22 = 2222
and not 44. Please help
 
Back
Top