Audit Trail

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Audit Trail

Post by D Willett »

I'm working with this article:
http://www.techrepublic.com/article/a-s ... cess-data/

Calling the routine as follows:

Code: Select all

Private Sub Form_BeforeUpdate(Cancel As Integer)
Select Case ctl.ControlType
  Case 100, 101, 104, 106, 109, 110, 111, 123, 124
    Call AuditTrail(Me, SalesOrderID)
  End Select
End Sub
Doesn't save the audit record and errors at RunTime error 424: Object Required.
I can't see where it is going wrong.
Help is appreciated.

Cheers
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78676
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Audit Trail

Post by HansV »

You can't do it like that. The variable ctl is neither defined nor assigned a value in Form_BeforeUpdate. As the article you refer to shows, the variable ctl is defined and used in the AuditTrail procedure (Sub). You have to call it the way specified in the article:

Code: Select all

Private Sub Form_BeforeUpdate(Cancel As Integer)
    Call AuditTrail(Me, SalesOrderID)
End Sub
where SalesOrderID is the primary key of the record source of your form.
Best wishes,
Hans