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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If/Then "formula" to do multiplication for total column in form

Status
Not open for further replies.
Mar 9, 1999
11
US
I am new to Access, but want to create a total column in my form. I have one field for "number of disks" and one field for "number of sets". I want to take and multiply these two fields to get a "total number of disks" field. What is the best way to write this and how [specifically], do I do this. I have Access 95 v7.0.<br>
<br>
You can respond here or to phendrix@hwins.com. Thanks for the help!
 
Ok, <br>
<br>
Try this:<br>
Look at the event properties of the last field that will be updated and press the build button (...) of the afterupdate property. Then select build code, and then enter this code. This should do the trick.<br>
<br>
Private Sub Text2_AfterUpdate()<br>
On error goto err_Text2<br>
<br>
me.text3 = me.text2 * me.text1<br>
<br>
Exit_Text2:<br>
Exit sub<br>
<br>
Err_Text2:<br>
msgbox err.description<br>
Resume Exit_text2<br>
End Sub
 
The other option would be to make a new query, in which you include all fields from your table along with the calculated field. Then you can base your form on the new query and treat it like all the other fields (except you won't be able to edit it, obviously).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top