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!

Before Update

Status
Not open for further replies.

alvintse

Programmer
Aug 1, 2003
66
US
Hi,
I have a table that I want to add two more fields to collect the update information whenever a record is updated. The two addition fields namely, date_modify with datatype= datetime and modified_by with datatype = number

I have added the following code:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If MsgBox("Update the record?", vbYesNo) = vbNo Then
Me.Undo
Else
date_modify = Now
modified_by = 123
End If
End Sub

I don't know what's wrong, if I only update the field date_modify, it looks like working fine. But if I tried to update the modified_by too, it doesn't work. It didn't updated and couldn't move to next record. It seems something wrong with the line modified_by = 123.

 
I think that is not an issue since the datatype is number.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top