473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Audit Log does not work for me

16
I am using Access 2003.
Regarding Allen Browne's audit log, I got copy all the codes and worked step by step according to the instructions, but there was some error occured when I tried to edit the data. The error message was Run-time error '3075': syntax error (missing operator) in query expression '(nameOfTheTableBeingAudited.KeyField = 1)'.
Is this a problem with the keyfield? This autonumber primary key does not seem to increment? Frankly speaking, I dont quite understand how this autonumber primary key work. How can it possibly know whether the new information is indeed a new record, therefore increase the index by one, or the info is just update on the existing record, keeping the same index.
Thank you for any reply in advance...

xiaowei
Jun 5 '07 #1
5 1856
Rabbit
12,516 Expert Mod 8TB
I am using Access 2003.
Regarding Allen Browne's audit log, I got copy all the codes and worked step by step according to the instructions, but there was some error occured when I tried to edit the data. The error message was Run-time error '3075': syntax error (missing operator) in query expression '(nameOfTheTableBeingAudited.KeyField = 1)'.
Is this a problem with the keyfield? This autonumber primary key does not seem to increment? Frankly speaking, I dont quite understand how this autonumber primary key work. How can it possibly know whether the new information is indeed a new record, therefore increase the index by one, or the info is just update on the existing record, keeping the same index.
Thank you for any reply in advance...

xiaowei
What is the full line of code that triggers the error? I've never used Allen Browne's audit log but I'll see what I can do.

Simply speaking, it knows if it's a new record or an update depending on which record it is on. Basically, new records are appended to the end of the table. If you are at the end of the table, then you are adding a new record, if you are on any record before that, then you are editing a record. The same goes for a form, except they often only show one record at a time. If you are at the end of the recordset of the form then you are adding a new record, if not, then you are editing a record.
Jun 5 '07 #2
xiaowei
16
What is the full line of code that triggers the error? I've never used Allen Browne's audit log but I'll see what I can do.

Simply speaking, it knows if it's a new record or an update depending on which record it is on. Basically, new records are appended to the end of the table. If you are at the end of the table, then you are adding a new record, if you are on any record before that, then you are editing a record. The same goes for a form, except they often only show one record at a time. If you are at the end of the recordset of the form then you are adding a new record, if not, then you are editing a record.
Hi rabbit, thank you for your reply...
This is the link to Allen Browne's code http://allenbrowne.com/AppAuditCode.html
and when I tried to modify the value of a field for an exiting record, I got this part highlighted:
If Not bWasNewRecord Then
sSQL = "INSERT INTO " & sAudTmpTable & " ( audType, audDate, audUser ) " & _
"SELECT 'EditFrom' AS Expr1, Now() AS Expr2, NetworkUserName() AS Expr3, " & sTable & ".* " & _
"FROM " & sTable & " WHERE (" & sTable & "." & sKeyField & " = " & lngKeyValue & ");"
db.Execute sSQL, dbFailOnError
End If
AuditEditBegin = True

I am totally lost... help!!!

xiaowei
Jun 6 '07 #3
Rabbit
12,516 Expert Mod 8TB
I am using Access 2003.
Regarding Allen Browne's audit log, I got copy all the codes and worked step by step according to the instructions, but there was some error occured when I tried to edit the data. The error message was Run-time error '3075': syntax error (missing operator) in query expression '(nameOfTheTableBeingAudited.KeyField = 1)'.
Is this a problem with the keyfield? This autonumber primary key does not seem to increment? Frankly speaking, I dont quite understand how this autonumber primary key work. How can it possibly know whether the new information is indeed a new record, therefore increase the index by one, or the info is just update on the existing record, keeping the same index.
Thank you for any reply in advance...

xiaowei
How are you calling the function?
Where are you calling the function?
What is the name of your audit log table?
What is the name of the table you're trying to log?
What is the name of the key field in the table you're trying to log?

His code requires you to define these names so it knows where to put everything. At this point, it looks like you're using what he left. I doubt your table is named nameOfTheTableBeingAudited.
Jun 6 '07 #4
xiaowei
16
Thank you rabbit, it is working fine with me now...
allen browne's instruction is very comprehensive and idiot-proof...
though I didnt really understand how it works when I just started over, I just followed, and I got all the tables named properly and functions been called correctly... so I was really confused why I kept getting this error message. I finally discovered that after putting "[ ]" around all the table names in the declaration of sql variables, it functioned just like the way as described. Not familiar with the syntax at all, so I dont know which should be the correct way... anyway it works now... I am so glad.. Thank you!!

Xiaowei
Jun 7 '07 #5
Rabbit
12,516 Expert Mod 8TB
Glad you got it working, good luck.
Jun 7 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Me | last post by:
Hi... A much lamented question, I guess.. I'm trying to create a simple audit trail. log the changes to an SQL 2000 table, so that they are written into a mirror table. The entire record, only...
3
by: Me | last post by:
Hi... A much lamented question, I guess.. I'm trying to create a simple audit trail. log the changes to an SQL 2000 table, so that they are written into a mirror table. The entire record, only...
0
by: JohnO | last post by:
Thanks to Serge and MarkB for recent tips and suggestions. Ive rolled together a few stored procedures to assist with creating audit triggers automagically. Hope someone finds this as useful as...
5
by: bruboj | last post by:
I created an audit trail for my access 97 database using code I found at: http://members.iinet.net.au/~allenbrowne/AppAudit.html One of the limitations stated for the code is "each table to be...
4
by: Bradley Burton | last post by:
I'm using Allen Brown's code for audit logging (http://allenbrowne.com/AppAudit.html), but I'm having a problem. My aud table doesn't populate with the tracking info at all. I think it might be a...
13
by: Jim M | last post by:
I've been playing with Allen Browne's audit code and found it very useful. I need to track record insertions, deletions, and edits for several tables. I am planning to replace Access with Microsoft...
6
by: Parag | last post by:
Hello, I have been assigned the task to design the audit trail for the ASP.NET web application. I don't know what the best practices for such audit trails are. Our application one dedicated user...
0
by: Santiago Cassina | last post by:
Hi list. I just want to send to you an sql file containing tools for audit the UPDATE and DELETE statements in a database by saving all the modifications made by a network/system/database user. I...
2
by: sara | last post by:
I have used Allen Browne's Audit Trail quite successfully. I now have an application where I have the user enter data on the top of the screen, and then put that data into a list box at the bottom...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.