Hi...I'm working blind with VBA and need some guidance.
I have a Personnel Form with several subforms. I need to keep track of who updates data and when. I have built a table called "tblUpdates" with Fields "datUpdate", "strUser" and "strField" and an AutoForm from it called "FormUpdates". I would like to keep a record of activity in this table.
In my personnel form on my "strLastName" OnChange Event I have written the following:
--------------------------------
Private Sub strLastName_Change()
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb()
Set rec = db.OpenRecordset("tblUpdates"
DoCmd.OpenForm "FormUpdates"
rec.MoveLast
rec.MoveFirst
rec.Edit
rec.AddNew
rec!datUpdate = Now()
rec!strUser = CurrentUser
rec!strField = "Last Name"
rec.Update
End Sub
_____________
This gives me an Error 3021 "No current User". I know I'm not even close to getting it right and would really appreciate if someone can put me on the right track.
I have a Personnel Form with several subforms. I need to keep track of who updates data and when. I have built a table called "tblUpdates" with Fields "datUpdate", "strUser" and "strField" and an AutoForm from it called "FormUpdates". I would like to keep a record of activity in this table.
In my personnel form on my "strLastName" OnChange Event I have written the following:
--------------------------------
Private Sub strLastName_Change()
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb()
Set rec = db.OpenRecordset("tblUpdates"
DoCmd.OpenForm "FormUpdates"
rec.MoveLast
rec.MoveFirst
rec.Edit
rec.AddNew
rec!datUpdate = Now()
rec!strUser = CurrentUser
rec!strField = "Last Name"
rec.Update
End Sub
_____________
This gives me an Error 3021 "No current User". I know I'm not even close to getting it right and would really appreciate if someone can put me on the right track.