What is wrong with my code?

A

Al

in the BeforeUpdate event I have the following:

=SetUpCtl_Before(Me)

this calls the following

Public Function SetUpCtl_Before(frm As Form)
With frm
FldName = .ActiveControl.Name
fldVal = .ActiveControl.OldValue
End With
Call AuditLogBefore(FldName, fldVal)
End Function
When I try to change anything in the field that has the function I get the
following Error Message:
"The expression beforeupdate you entered as the event property setting
produced the following error: the object does not contain the automation
object 'Me.'"
I do not know what is the wrong with my code?
Please help
 
J

John Smith

'Me' is only valid in VBA code. If you have SetUpCtl_Before(Me) as the
property of an event rather than in code attached to an event then you need to
use instead:

=SetUpCtl_Before(Form)

HTH
John
##################################
Don't Print - Save trees
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top