Good morning all. In a form, my aim is to track changes in fields. Once I have a list of changed fields, I'll run code to send an email and list teh fields in teh message body. Email is fine, but I am having problems gathering the data.
On update of a field / text box I get an error the expression you entered has a function name that MS Access cannot find.
The code is as follows
Private Sub Form_Current()
ListOfUpdatedControls = ""
End Sub
Private Sub Form_Load()
Dim ct As Access.Control
For Each ct In Me.Detail.Controls
If ct.ControlType = acTextBox Then
ct.AfterUpdate = "=Fn_ListUpdatedControls('" & ct.Name & "')"
End If
Next
End Sub
Module1
(Declarations)
Private ListOfUpdatedControls As String
______________________________________________________
Private Function Fn_ListUpdatedControls(controlname As String)
If InStr(ListOfUpdatedControls, controlname) > 0 Then
Else
ListOfUpdatedControls = ListOfUpdatedControls & "," & controlname
End If
MsgBox "Following Controls Updated so far" & " In Current Record: " & vbCrLf & Mid(ListOfUpdatedControls, 2)
End Function
_______________________________________________________
Have I setup the function in the wrong place?
If you have any other easier ideas to gather data of a changed record please post up
Many thanks
Larry B
On update of a field / text box I get an error the expression you entered has a function name that MS Access cannot find.
The code is as follows
Private Sub Form_Current()
ListOfUpdatedControls = ""
End Sub
Private Sub Form_Load()
Dim ct As Access.Control
For Each ct In Me.Detail.Controls
If ct.ControlType = acTextBox Then
ct.AfterUpdate = "=Fn_ListUpdatedControls('" & ct.Name & "')"
End If
Next
End Sub
Module1
(Declarations)
Private ListOfUpdatedControls As String
______________________________________________________
Private Function Fn_ListUpdatedControls(controlname As String)
If InStr(ListOfUpdatedControls, controlname) > 0 Then
Else
ListOfUpdatedControls = ListOfUpdatedControls & "," & controlname
End If
MsgBox "Following Controls Updated so far" & " In Current Record: " & vbCrLf & Mid(ListOfUpdatedControls, 2)
End Function
_______________________________________________________
Have I setup the function in the wrong place?
If you have any other easier ideas to gather data of a changed record please post up
Many thanks
Larry B