I was able to accomplish this task using the Before_update event on both the main and subform. This worked for a day or two, but then I need to make a small change. The change did not work, so I put the code back to the original code which worked and now the [Record Edited] field updates when you tab from the main form to the subform, and from the subform to the main form. Below is the code I am currently using in the main form:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim wks As DAO.Workspace
Set db = CurrentDb()
Set rec = db.OpenRecordset("tblRolodex"
Set wks = DBEngine(0)
[Sys_User_ID_Edited].Locked = False
[Sys_User_ID_Edited] = wks.UserName
[Record_Edited].Locked = False
[Record_Edited] = Now()
'rec.MoveNext rec.Close
Set rec = Nothing
End Sub
The subform's method:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim wks As DAO.Workspace
Set db = CurrentDb()
Set rec = db.OpenRecordset ("tblRolodexContact"
Set wks = DBEngine(0)
Forms!frmRolodex.[Sys_User_ID_Edited].Locked = False
Forms!frmRolodex.[Sys_User_ID_Edited] = wks.UserName
Forms!frmRolodex.[Record_Edited].Locked = False
Forms!frmRolodex.[Record_Edited] = Now()
rec.MoveNext
rec.Close
Set rec = Nothing
End Sub
Thanks,
Suzanne
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim wks As DAO.Workspace
Set db = CurrentDb()
Set rec = db.OpenRecordset("tblRolodex"
Set wks = DBEngine(0)
[Sys_User_ID_Edited].Locked = False
[Sys_User_ID_Edited] = wks.UserName
[Record_Edited].Locked = False
[Record_Edited] = Now()
'rec.MoveNext rec.Close
Set rec = Nothing
End Sub
The subform's method:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim wks As DAO.Workspace
Set db = CurrentDb()
Set rec = db.OpenRecordset ("tblRolodexContact"
Set wks = DBEngine(0)
Forms!frmRolodex.[Sys_User_ID_Edited].Locked = False
Forms!frmRolodex.[Sys_User_ID_Edited] = wks.UserName
Forms!frmRolodex.[Record_Edited].Locked = False
Forms!frmRolodex.[Record_Edited] = Now()
rec.MoveNext
rec.Close
Set rec = Nothing
End Sub
Thanks,
Suzanne