Hello
I have a form with 3 textboxes where the user inputs numbers. Each box its bounded to its particular field in a table. I want to SUM the values of those 3 textboxes so that the total is stored in that same table.
Ive tried:
CODE
Me.L1.Value = [L1_Driver] + [L1_Passenger] + [L1_Rear]
but it doesnt return ANYTHING
I don't really have much experience with bounded text boxes, but try updating the field that L1 is bound to instead, and let it update the textbox itself.
Eg (assuming your table is called VEHICLE, the primary key is REG, which is stored in a textbox called txtReg, and L1 is bound to a field called TOTAL - alter the code accordingly)
-
dim total as Single
-
total = CSng([L1_Driver]) + CSng([L1_Passenger]) + CSng([L1_Rear])
-
DoCmd.RunSQL("UPDATE yourtablenamehere SET total = " & total & " WHERE REG = '" & txtReg.value & "';")
-
If that doesn't work, try reopening the form and then see if it has updated. I'm sure someone here can tell you how to requery a bound form.
Hope this helps.