PDA

View Full Version : BeforeUpdate Event Problems



salating
08-29-2005, 12:50 PM
I have a text box that the user enters a number in. It pulls the price from another table and updates the variable "charge" and shows the updated price in a textbox on the form.

problem is when the user creates a new record and puts a number in the textbox, it erases the charge from the textbox that displays the updated charge.


here is the code


Private Sub numEdu_BeforeUpdate(Cancel As Integer)
intSubscript = selectCustomer.ListIndex
charge = charge - (Me.numEdu.OldValue * m_educ(intSubscript))
End Sub

numEdu is assigned to the input textbox

geekgirlau
08-29-2005, 03:38 PM
Wouldn't you be better off having the calculation in a separate text box that the user cannot change?

salating
08-30-2005, 05:25 AM
the user has to enter a number in the text box for the new record, and when they do before the new record is saved, it erases the variable charge

now if a new record is entered and saved, the user can go back and enter the number for the variable numEdu and it will update the variable charge

i need it to update charge before the record is saved for a new record with out erasing charge

xCav8r
09-19-2005, 09:46 PM
Salating, :hi:

Welcome to VBAX!

I'm sure if you provided a tiny sample for us, we could get you fixed right quick! ;)