Audit Code - Allen Browne

H

Heather

I am trying to use his Audit code and I keep getting Compile Error Variable
not Defined on my BeforeUpdate -

can someone tell me what am I missing?

Private Sub Form_BeforeUpdate(Cancel As Integer)
bWasNewRecord = Me.NewRecord
Call AuditEditBegin("Tbl_Report_Data", "sAudTmpTable", "RPT_OLD_ID",
Nz(Me.RPT_OLD_ID, 0), bWasNewRecord)
End Sub

Thanks - H-
 
M

Maurice

maybe declare bWasNewRecord first? something like:

dim bWasNewRecord as Boolean

and i assume you do have the rest of the code routines you are calling
(AuditEditBegin)

which version are you using?

hth
 
H

Heather

I am in Access 2003 - the table I want to want to Audit is call
Tbl_Report_Data and the Primary Key in the Table is called RPT_ID it is set
to an autonumber.

I followed all the steps from this website -
http://allenbrowne.com/AppAudit.html

According to the site I need to use the primary key of the table being audited
When I use RPT_ID which is the PK in (Tbl_Report_Data ) I go to my form make
a change on save I get:

Complile error: Method or data member not found

'*** I made this update based on your last post still did not work
Dim bWasNewRecord As Boolean
Call AuditEditBegin("Tbl_Report_Data", "sAudTmpTable", "RPT_ID",
Nz(Me.RPT_ID, 0), bWasNewRecord)




Also it says that
 
M

Maurice

Ok, read the article from Allen. The boolean declaration should be placed all
the way at the top (just under option explicit). Furthermore are you sure you
have taken all the steps Allen has described? Sorry to ask but as Allen
stated this is a tough piece of work you have to do to get this working.

So not to be discouraging but try stepping through it one more time step by
step with the articel beside you. It's very hard to see what you might have
forgotten if you didn't take all the steps.
 
H

Heather

Why does my Primary Key field not show up? All my other field in the Table
do but the one I have set PK does not

Me.RPT_ID this is were it errors
 

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