B
BrianDP
Regarding the piece of code below, if I run it from a button on a
form, it writes the correct value into the "Lcontrol" table, however
if I run the code from the "close" event, it writes an incorrect value
to the "Lcontrol" table.
Private Sub Form_Close()
Dim cc As Integer
Dim db As Database
Dim rst As Recordset
cc = Forms![customer definition]!cust_code
Set db = CurrentDb()
Set rst = db.OpenRecordset("lcontrol")
rst.MoveFirst
rst.Edit
rst!lastcust = cc
rst.Update
rst.Close
End Sub
form, it writes the correct value into the "Lcontrol" table, however
if I run the code from the "close" event, it writes an incorrect value
to the "Lcontrol" table.
Private Sub Form_Close()
Dim cc As Integer
Dim db As Database
Dim rst As Recordset
cc = Forms![customer definition]!cust_code
Set db = CurrentDb()
Set rst = db.OpenRecordset("lcontrol")
rst.MoveFirst
rst.Edit
rst!lastcust = cc
rst.Update
rst.Close
End Sub