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

calculating in a form and trying .......

Status
Not open for further replies.

gnibbles

Programmer
Mar 15, 2000
79
CA
Im calculating a telephone bill with local_charges, long_Distance, Tax, etc and well when I calculate it it wont go into the table. I've tried linking the field with an invisible field that does the calculations, I've tried building code, I dont want to try a query, I want something sraight forward, but good luck with access. anyways if anyone can help me out Id appreciate it thanks.
 
have you tried using SQL with an update statement or you can use VB&nbsp;&nbsp;and have it updated <br>(name of recordset).FindFirst &quot;(Criteria)&quot;<br>(name of recordset).Add<br>(name of recordset)!(name of field in table to update) = (formula)<br>(name of recordset).Upadate<br><br>You have to declare and set both a database variable and a recordset variable in that order <br><br>Walter III
 
this is what i have so far<br><br>Private Sub Total_Enter()<br>Dim db As Database<br>Dim rst As Recordset<br>Dim strSQL As String<br><br>Set db = CurrentDb<br>strSQL = &quot;SELECT Total FROM [Actual Payments] &quot;<br>Set rst = db.OpenRecordset(strSQL)<br>rst.FindFirst<br>rst.Add<br>rst!Total = ([Local_Charges] + [Other_Charges] + [Total_Long_Distance] + [Misc] + [Tax] + [Adjustments])<br>rst.Update<br><br><br>End Sub
 
you say you are doing this on a form?<br><br>place this in an unbound textbox on your form <br>= ([Local_Charges] + [Other_Charges] + [Total_Long_Distance] + [Misc] + [Tax] + [Adjustments])<br>name it txttotal&nbsp;&nbsp;it should now display the total. <br><br>now in the code change the one line to read<br>rst!Total = me.txtTotal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top