Hello All,
I have this code below that works just fine however, I don't believe I have it in the correct event. When I have it in this event it does not fire when record has been changed. I have to click to the new record, click back, and edit the record. Then I get a message that the record has been changed.
How do I get this to fire whenever the record has been saved? I thought about a message box that ask if they want to save this record or not. If they click yes then it would fire.
Any Ideas??
I have this code below that works just fine however, I don't believe I have it in the correct event. When I have it in this event it does not fire when record has been changed. I have to click to the new record, click back, and edit the record. Then I get a message that the record has been changed.
How do I get this to fire whenever the record has been saved? I thought about a message box that ask if they want to save this record or not. If they click yes then it would fire.
Any Ideas??
Code:
Private Sub Form_AfterUpdate()
Dim dd As Date
Dim dbs As DAO.Database
Set dbs = CurrentDb
Dim pID As Long
Dim sHostName As String
Dim sUserName As String
Dim cmd As String
pID = [Product ID].Value
dd = Format(Now(), "dd/mm/yyyy hh:mm:ss")
' Get Host Name / Get Computer Name
sHostName = Environ("computername")
' Get Current User Name
sUserName = Environ("username") 'Username is obtained to produce Time and UserStamp
cmd = "UPDATE Product SET DateStamp=#" & dd & "#, UserStamp='" & sUserName & "' WHERE [product ID]=" & pID & ""
dbs.Execute cmd, dbSeeChanges
End Sub