I would like to enter a record in a table if a value of a control changes on a form.
I would also like to enter record in the same table if the record is new with a differing value in one of the fields.
I can code the first part, but have not been able to figure out a way to get the 2nd part to work. Any ideas? Not sure where I could run this code.
I have tried to code to run on close, before update etc.
Here is the code I use when changing the field:
I would also like to enter record in the same table if the record is new with a differing value in one of the fields.
I can code the first part, but have not been able to figure out a way to get the 2nd part to work. Any ideas? Not sure where I could run this code.
I have tried to code to run on close, before update etc.
Here is the code I use when changing the field:
Code:
Private Sub Who_AfterUpdate()
If Me.Who <> Me.Who.OldValue Then
Dim strwho As String
Dim itgID As Integer
Dim strwhat As String
Dim ddd As Date
Dim tblCustomers As DAO.Recordset
DoCmd.SetWarnings False
ddd = Now()
strwho = Me.Who
itgID = Me.ID
'Dim intnewrec As Integer
'intnewrec = frmToDoListEntry.NewRecord
Set tblToDoListLog = CurrentDb.OpenRecordset("SELECT * From[tblToDoListLog]")
tblToDoListLog.AddNew
tblToDoListLog![ID] = itgID
Debug.Print itgID
tblToDoListLog![Who] = strwho
tblToDoListLog![DateAction] = ddd
tblToDoListLog![What] = "Reassigned to " & strwho
tblToDoListLog.Update
tblToDoListLog.Close
Set tblToDoListLog = Nothing
End If
End Sub