473,756 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange Behavior - Allen Browne's Edit Tracking sometimes doesn't write to table

I use Allen Browne's Audit Trail code in everything I do and I love
it.

Recently, I've run into a problem I can't figure out.

I have a database with about 35 lookup tables. I am creating an
"Admin" screen to allow the head social worker to maintain items in
the list. (This is a volunteer project for a non-profit that is trying
to help elders "age successfully" in their own homes, and I'm trying
to help them do some tracking for analysis later.)

I have a table of Phone Types (Home, Office, etc). and a table of
Religions (none, Catholic, Protestant, Jewish, etc).

To test the form and the audit, I choose an item, add an "s", close
the form. Go back in and remove the "s" so the original item is
displayed.

I should see 4 records: Edit From, Edit To, Edit From, Edit To.

On the religion one, I see the first Edit From, Edit To, but not the
second set. If I do it over and over I don't even see the first set
all the time.

I have stepped through the code and don't see anything wrong (but I'm
not an advanced code-writer by any stretch). I have "break on all
errors" and there are no breaks (no errors, I presume).
BUT, my audit table keys are skipping: I go from 57 and 58 to 65 and
66. I know 59 and 60, 61 and 62, 63 and 64 SHOULD have been there - I
was adding and removing an "s" from the item name right along.

GENERALLY, when I add the "s" I see the audit records; when I remove
it I don't. But that hasn't always been the case. In other forms,
I've added and removed an "s" to an item 6-8 times, and all the edit
records are in the table. I created a new form, copying one that
worked and changing the field and table names - problem still exists.

I tried changing my recordset code to DCount - same thing happens.
(I'm trying to make sure the user doesn't change to something that
exists).

I figure it might be something in the table or audit table, but what?

Thanks for the help with this mystery -
Sara

Code:
http://allenbrowne.com/AppAudit.html (Audit Trail code) - inserted
right from Web

Private Sub Form_BeforeUpda te(Cancel As Integer)

' Uses Allen Browne's Audit Trail code to track user changes

' Check to make sure there is no Active record with this description
first
'Dim intcount As Integer

Dim strSQL As String
strSQL = "Select Religion From tlkpReligion " & _
"Where ReligionKey <" & Me.txtReligionK ey & " And "
& _
"Religion = '" & Me.txtReligion & "' And " & _
"ReligionRecord Status = 'A'"

Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenR ecordset(strSQL )

'intcount = DCount("Religio n", "tlkpReligi on", "Religion = '"
& Me.txtReligion & "' And " & _
"ReligionRecord Status = 'A'")

If rst.RecordCount 0 Then
'If intcount 0 Then
MsgBox "This description already exists.", , "JFSMW -
No Update"
Err.Number = 0
Cancel = True
Exit Sub
End If
bWasNewRecord = Me.NewRecord
Call AuditEditBegin( "tlkpReligi on", "audTmpReligion ",
"ReligionKe y", _
Nz(Me.txtReligi onKey, 0), bWasNewRecord)

End Sub
Private Sub Form_AfterUpdat e()

Me.cboReligion. Requery
Me.cboReligion = Me.txtReligionK ey

Call AuditEditEnd("t lkpReligion", "audTmpReligion ", "audReligio n",
_
"ReligionKe y", Nz(Me.txtReligi onKey, 0), bWasNewRecord)
End Sub

Jun 24 '07 #1
2 1662
Comment out the error handler. It should fail on the insert, and give you a
message.

For example, if your audit table has a unique index on one of the fields, it
won't allow a 2nd record to be written.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"sara" <sa*******@yaho o.comwrote in message
news:11******** *************@p 77g2000hsh.goog legroups.com...
>I use Allen Browne's Audit Trail code in everything I do and I love
it.

Recently, I've run into a problem I can't figure out.

I have a database with about 35 lookup tables. I am creating an
"Admin" screen to allow the head social worker to maintain items in
the list. (This is a volunteer project for a non-profit that is trying
to help elders "age successfully" in their own homes, and I'm trying
to help them do some tracking for analysis later.)

I have a table of Phone Types (Home, Office, etc). and a table of
Religions (none, Catholic, Protestant, Jewish, etc).

To test the form and the audit, I choose an item, add an "s", close
the form. Go back in and remove the "s" so the original item is
displayed.

I should see 4 records: Edit From, Edit To, Edit From, Edit To.

On the religion one, I see the first Edit From, Edit To, but not the
second set. If I do it over and over I don't even see the first set
all the time.

I have stepped through the code and don't see anything wrong (but I'm
not an advanced code-writer by any stretch). I have "break on all
errors" and there are no breaks (no errors, I presume).
BUT, my audit table keys are skipping: I go from 57 and 58 to 65 and
66. I know 59 and 60, 61 and 62, 63 and 64 SHOULD have been there - I
was adding and removing an "s" from the item name right along.

GENERALLY, when I add the "s" I see the audit records; when I remove
it I don't. But that hasn't always been the case. In other forms,
I've added and removed an "s" to an item 6-8 times, and all the edit
records are in the table. I created a new form, copying one that
worked and changing the field and table names - problem still exists.

I tried changing my recordset code to DCount - same thing happens.
(I'm trying to make sure the user doesn't change to something that
exists).

I figure it might be something in the table or audit table, but what?

Thanks for the help with this mystery -
Sara

Code:
http://allenbrowne.com/AppAudit.html (Audit Trail code) - inserted
right from Web

Private Sub Form_BeforeUpda te(Cancel As Integer)

' Uses Allen Browne's Audit Trail code to track user changes

' Check to make sure there is no Active record with this description
first
'Dim intcount As Integer

Dim strSQL As String
strSQL = "Select Religion From tlkpReligion " & _
"Where ReligionKey <" & Me.txtReligionK ey & " And "
& _
"Religion = '" & Me.txtReligion & "' And " & _
"ReligionRecord Status = 'A'"

Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenR ecordset(strSQL )

'intcount = DCount("Religio n", "tlkpReligi on", "Religion = '"
& Me.txtReligion & "' And " & _
"ReligionRecord Status = 'A'")

If rst.RecordCount 0 Then
'If intcount 0 Then
MsgBox "This description already exists.", , "JFSMW -
No Update"
Err.Number = 0
Cancel = True
Exit Sub
End If
bWasNewRecord = Me.NewRecord
Call AuditEditBegin( "tlkpReligi on", "audTmpReligion ",
"ReligionKe y", _
Nz(Me.txtReligi onKey, 0), bWasNewRecord)

End Sub
Private Sub Form_AfterUpdat e()

Me.cboReligion. Requery
Me.cboReligion = Me.txtReligionK ey

Call AuditEditEnd("t lkpReligion", "audTmpReligion ", "audReligio n",
_
"ReligionKe y", Nz(Me.txtReligi onKey, 0), bWasNewRecord)
End Sub
Jun 24 '07 #2
On Jun 24, 12:23 pm, "Allen Browne" <AllenBro...@Se eSig.Invalid>
wrote:
Comment out the error handler. It should fail on the insert, and give you a
message.

For example, if your audit table has a unique index on one of the fields, it
won't allow a 2nd record to be written.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"sara" <saraqp...@yaho o.comwrote in message

news:11******** *************@p 77g2000hsh.goog legroups.com...
I use Allen Browne's Audit Trail code in everything I do and I love
it.
Recently, I've run into a problem I can't figure out.
I have a database with about 35 lookup tables. I am creating an
"Admin" screen to allow the head social worker to maintain items in
the list. (This is a volunteer project for a non-profit that is trying
to help elders "age successfully" in their own homes, and I'm trying
to help them do some tracking for analysis later.)
I have a table of Phone Types (Home, Office, etc). and a table of
Religions (none, Catholic, Protestant, Jewish, etc).
To test the form and the audit, I choose an item, add an "s", close
the form. Go back in and remove the "s" so the original item is
displayed.
I should see 4 records: Edit From, Edit To, Edit From, Edit To.
On the religion one, I see the first Edit From, Edit To, but not the
second set. If I do it over and over I don't even see the first set
all the time.
I have stepped through the code and don't see anything wrong (but I'm
not an advanced code-writer by any stretch). I have "break on all
errors" and there are no breaks (no errors, I presume).
BUT, my audit table keys are skipping: I go from 57 and 58 to 65 and
66. I know 59 and 60, 61 and 62, 63 and 64 SHOULD have been there - I
was adding and removing an "s" from the item name right along.
GENERALLY, when I add the "s" I see the audit records; when I remove
it I don't. But that hasn't always been the case. In other forms,
I've added and removed an "s" to an item 6-8 times, and all the edit
records are in the table. I created a new form, copying one that
worked and changing the field and table names - problem still exists.
I tried changing my recordset code to DCount - same thing happens.
(I'm trying to make sure the user doesn't change to something that
exists).
I figure it might be something in the table or audit table, but what?
Thanks for the help with this mystery -
Sara
Code:
http://allenbrowne.com/AppAudit.html(Audit Trail code) - inserted
right from Web
Private Sub Form_BeforeUpda te(Cancel As Integer)
' Uses Allen Browne's Audit Trail code to track user changes
' Check to make sure there is no Active record with this description
first
'Dim intcount As Integer
Dim strSQL As String
strSQL = "Select Religion From tlkpReligion " & _
"Where ReligionKey <" & Me.txtReligionK ey & " And "
& _
"Religion = '" & Me.txtReligion & "' And " & _
"ReligionRecord Status = 'A'"
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenR ecordset(strSQL )
'intcount = DCount("Religio n", "tlkpReligi on", "Religion = '"
& Me.txtReligion & "' And " & _
"ReligionRecord Status = 'A'")
If rst.RecordCount 0 Then
'If intcount 0 Then
MsgBox "This description already exists.", , "JFSMW -
No Update"
Err.Number = 0
Cancel = True
Exit Sub
End If
bWasNewRecord = Me.NewRecord
Call AuditEditBegin( "tlkpReligi on", "audTmpReligion ",
"ReligionKe y", _
Nz(Me.txtReligi onKey, 0), bWasNewRecord)
End Sub
Private Sub Form_AfterUpdat e()
Me.cboReligion. Requery
Me.cboReligion = Me.txtReligionK ey
Call AuditEditEnd("t lkpReligion", "audTmpReligion ", "audReligio n",
_
"ReligionKe y", Nz(Me.txtReligi onKey, 0), bWasNewRecord)
End Sub- Hide quoted text -

- Show quoted text -

That's it! Thanks so much. I had (shame on me!) left the indexes in
the audit table. It all works now and I shall go check every audit
and audit temp table to make sure I didn't do the same on any other
tables.

By the way, I love the audit trail code - helps me resolve user issues
on occasion, as well as helps me find my errors. Thanks!

Sara

Jun 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1909
by: Eric E | last post by:
Hi all, I have a fairly complex form in Access 2000. In particular, it has two subforms on separate tabs of a tab control. For the last two weeks, I've encountered the dreaded : "You can't carry out this action at the present time." error, runtime 2486. Subsequently Access will not exit the form, and shuts down uncleanly. Looking back on the messages here, this seems to be an indication of a corrupt object in the .mdb. So I imported...
3
1467
by: Karl Roes | last post by:
Hi All, I have a form with a standard combo box and 5 tabs in A2003. On Form Open, I set Me.Detail.Visible = False and in the after update event of the combo set Me.Detail.Visible = True,( to open form with no info showing ) I've noticed something quite strange. I open the form ( details are not visible ) select any record ID with the combo and the details come up OK. I click anywhere on the
4
2747
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 problem with the table set-up. I just can't find the problem. These are the fields in my table: Table1 ID (primary key) AutoNumber
15
3076
by: Jerry Alexander | last post by:
The Northwind Order Entry Application database is great! ----------------------------------------- But one thing is lacking: Real-time Stock Qty calculation! ----------------------------------------- I know that this topic has been discussed over & over in forums, but I have yet to find anyone that has shown the following: ----------------- 1) Linking Allen Browne's code to Northwind? then an 2) Inventory report to show Products &...
7
3387
by: Swinky | last post by:
Mr. Browne's copy code on his web site has saved me. I have been struggling to copy a record with several related sub-form tables. I found code on his web site that copies a sub-form table, implemented it and was successful to make it work. Thank you Mr. Browne! However, the copy code on his web site only updates one sub-form table. My database has three sub-forms that need to be updated. Although, I am not a programmer (I am...
4
3795
by: Kelii | last post by:
Hi all, (WinXP Pro SP2, Access 2003) I'm using Dev Ashish's fRefreshLinks function from AccessWeb (http://www.mvps.org/access/tables/tbl0009.htm) to relink tables in my front end to one of several back end files. When I first dropped in the function I was getting an error on one of my tables saying "Couldn't relink table, table doesn't exist"... or
5
1774
by: john | last post by:
A record of a table with an autonumber field was accidentally deleted. From the backup table I made a new table with only the deleted record. Then with an add query I added that record to the original table. After that, when adding a new record, the autonumber continued with the last ID value (from the add query) + 1 there by overriding already existing records. Is this WAD? What should be best to do in such a situation?
9
1834
by: sara | last post by:
Hi - I have code (below) that ran as recently as Monday. We decided to change the location for the output reports, and now the code errors (13 Type Mismatch) on the query. The query runs fine on its own. The code still runs fine from the .mde. If I undo the change (single line) I STILL get the error. The .mdb compiles fine.
6
2742
by: babamc4 | last post by:
I have a main form (mainformlung) with 5 subforms (followupacute, followuplate, biochemresults, haemresults and pftresults). I have copied Allen Browne's Audit Trail code (thanks to Allen Browne) and this is working great, edit, insert etc is working bar when I try to delete a record in one of my subforms (I'm in test stage at the mo) I get a run time error 3022 'The changes you requested to the table where not successful because they would...
0
9255
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10014
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9819
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9689
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7226
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3780
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.