Can't Find Private Function

LarryB

Registered User.
Local time
Today, 17:33
Joined
Jun 19, 2012
Messages
66
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
 
Try changing:-

Private Function Fn_ListUpdatedControls(controlname As String)
to:-
Public Function Fn_ListUpdatedControls(controlname As String)

Chris.
 
OK I need a slap in the chops!!

That works fine. You're a gent! Have a great weekend!
 
Chop-slapping is dispensed here for free 24/7/365 - come back when the urge is over you again.:D
 
cheers lad! I'll avail of this treatment next time my brain decides to fail!!
 

Users who are viewing this thread

Back
Top Bottom