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!

Try the following code in your form

Status
Not open for further replies.

jfischer

Programmer
May 24, 2001
343
US
Try the following code in your form:
Code:
Private Sub Form_BeforeInsert(Cancel As Integer)
  Me!UserID = CurrentUser
End Sub
 
Better is:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me!UserID = CurrentUser
End Sub

In such case user who updates data each time will be registered
Aivars
 
Thanks, but matpj had requested that updates NOT overwrite the original record.
 
Use the before update, but only add the record when it's a new record by testing the Dirty property of the form:

If Me.Dirty = True Then
Me!UserID = CurrentUser
End If

HTH Joe Miller
joe.miller@flotech.net
 
I'm sorry I messed up!! Use the NewRecord property of the form NOT dirty.

If Me.NewRecord = True Then
Me!UserID = CurrentUser
End If

HTH Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top