By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,218 Members | 1,498 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,218 IT Pros & Developers. It's quick & easy.

Access 97 bogus duplicate records

P: n/a
I have been working with an A97 database that performs a data processing
function. It imports data from a flat text file then uses a dao transaction
that executes a number of sql statements (about 30 in all) to append to
various tables, delete records, copy from table A to table B etc, ultimately
downloading to a series of text files that contain 'processed data'.

The issue is that on the odd occasion (this process is executed every
business day and this issue occurs roughly once every 2 to 3 months) the
process goes totally haywire and some of the tables end up with thousands
and thousands of duplicate records. Like today a table that should have had
a couple of thousand records ended up with over 800,000 records!!! When
this was de-duped we were back to a couple of thousand. This doesnt appear
to be an issue with the code. Firstly I have checked it and secondly this
only happens on the odd occasion. It is as if for some reason Access
repeats the same INSERT.. statement over and over and over again even though
there are no loops in the code that is being executed. Possibly this is to
do with recursive queries but even this doesnt seem to be the case based on
the logic the application uses.

Has anyone out there come across this issue or know of what could be causing
this?

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Andrew.

Never seen anything like that, but there are a few things that might be
worth checking out.

The first thing that comes to mind is to check the error handling. Is there
any conceivable way that an error could be occurring WITHOUT a rollback? If
so, this leaves an uncommitted level of transaction. If the process were
then repeated (or continued/picked up by another routine), it might be
possible to end up with a situation where the original uncommitted
transaction that you thought was abandoned is actually being committed, and
so the effect appears to be that the process has been duplicated.

Presumably you are using dbFailOnError with all executes. There are some
weird things that happen if you don't. (For example, if you execute a
mal-formed append query statement without dbFailOnError, Access will report
zero RecordsAffected, even though records were appended.)

Because these rare/intermittent things can be very hard to trace, it may be
worth adding some logging to the procedures, logging the beginning of each
transaction, each SQL string being executed, the RecordsAffected for each
one, and the end result (CommitTrans or Rollback). The log could be
invaluable once it goes bad again. (Naturally you will need to ensure that
the logging is outside all transaction levels.)

There are other possible issues that might be worth considering. For
example, there can be strange side-effects from closing the default
workspace, or from using CurrentDb instead of ws(0).

HTH

--
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.

"Andrew Chanter" <he****@radsolutions.com.au> wrote in message
news:ds******************@news-server.bigpond.net.au...
I have been working with an A97 database that performs a data processing
function. It imports data from a flat text file then uses a dao
transaction that executes a number of sql statements (about 30 in all) to
append to various tables, delete records, copy from table A to table B etc,
ultimately downloading to a series of text files that contain 'processed
data'.

The issue is that on the odd occasion (this process is executed every
business day and this issue occurs roughly once every 2 to 3 months) the
process goes totally haywire and some of the tables end up with thousands
and thousands of duplicate records. Like today a table that should have
had a couple of thousand records ended up with over 800,000 records!!!
When this was de-duped we were back to a couple of thousand. This doesnt
appear to be an issue with the code. Firstly I have checked it and
secondly this only happens on the odd occasion. It is as if for some
reason Access repeats the same INSERT.. statement over and over and over
again even though there are no loops in the code that is being executed.
Possibly this is to do with recursive queries but even this doesnt seem to
be the case based on the logic the application uses.

Has anyone out there come across this issue or know of what could be
causing this?

Nov 13 '05 #2

P: n/a
Hi Andrew.

Never seen anything like that, but there are a few things that might be
worth checking out.

The first thing that comes to mind is to check the error handling. Is there
any conceivable way that an error could be occurring WITHOUT a rollback? If
so, this leaves an uncommitted level of transaction. If the process were
then repeated (or continued/picked up by another routine), it might be
possible to end up with a situation where the original uncommitted
transaction that you thought was abandoned is actually being committed, and
so the effect appears to be that the process has been duplicated.

Presumably you are using dbFailOnError with all executes. There are some
weird things that happen if you don't. (For example, if you execute a
mal-formed append query statement without dbFailOnError, Access will report
zero RecordsAffected, even though records were appended.)

Because these rare/intermittent things can be very hard to trace, it may be
worth adding some logging to the procedures, logging the beginning of each
transaction, each SQL string being executed, the RecordsAffected for each
one, and the end result (CommitTrans or Rollback). The log could be
invaluable once it goes bad again. (Naturally you will need to ensure that
the logging is outside all transaction levels.)

There are other possible issues that might be worth considering. For
example, there can be strange side-effects from closing the default
workspace, or from using CurrentDb instead of ws(0).

HTH

--
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.

"Andrew Chanter" <he****@radsolutions.com.au> wrote in message
news:ds******************@news-server.bigpond.net.au...
I have been working with an A97 database that performs a data processing
function. It imports data from a flat text file then uses a dao
transaction that executes a number of sql statements (about 30 in all) to
append to various tables, delete records, copy from table A to table B etc,
ultimately downloading to a series of text files that contain 'processed
data'.

The issue is that on the odd occasion (this process is executed every
business day and this issue occurs roughly once every 2 to 3 months) the
process goes totally haywire and some of the tables end up with thousands
and thousands of duplicate records. Like today a table that should have
had a couple of thousand records ended up with over 800,000 records!!!
When this was de-duped we were back to a couple of thousand. This doesnt
appear to be an issue with the code. Firstly I have checked it and
secondly this only happens on the odd occasion. It is as if for some
reason Access repeats the same INSERT.. statement over and over and over
again even though there are no loops in the code that is being executed.
Possibly this is to do with recursive queries but even this doesnt seem to
be the case based on the logic the application uses.

Has anyone out there come across this issue or know of what could be
causing this?

Nov 13 '05 #3

P: n/a
On Wed, 03 Aug 2005 12:07:37 GMT, "Andrew Chanter"
<he****@radsolutions.com.au> wrote:

A well-placed unique index would make this impossible.
-Tom.

I have been working with an A97 database that performs a data processing
function. It imports data from a flat text file then uses a dao transaction
that executes a number of sql statements (about 30 in all) to append to
various tables, delete records, copy from table A to table B etc, ultimately
downloading to a series of text files that contain 'processed data'.

The issue is that on the odd occasion (this process is executed every
business day and this issue occurs roughly once every 2 to 3 months) the
process goes totally haywire and some of the tables end up with thousands
and thousands of duplicate records. Like today a table that should have had
a couple of thousand records ended up with over 800,000 records!!! When
this was de-duped we were back to a couple of thousand. This doesnt appear
to be an issue with the code. Firstly I have checked it and secondly this
only happens on the odd occasion. It is as if for some reason Access
repeats the same INSERT.. statement over and over and over again even though
there are no loops in the code that is being executed. Possibly this is to
do with recursive queries but even this doesnt seem to be the case based on
the logic the application uses.

Has anyone out there come across this issue or know of what could be causing
this?


Nov 13 '05 #4

P: n/a
On Wed, 03 Aug 2005 12:07:37 GMT, "Andrew Chanter"
<he****@radsolutions.com.au> wrote:

A well-placed unique index would make this impossible.
-Tom.

I have been working with an A97 database that performs a data processing
function. It imports data from a flat text file then uses a dao transaction
that executes a number of sql statements (about 30 in all) to append to
various tables, delete records, copy from table A to table B etc, ultimately
downloading to a series of text files that contain 'processed data'.

The issue is that on the odd occasion (this process is executed every
business day and this issue occurs roughly once every 2 to 3 months) the
process goes totally haywire and some of the tables end up with thousands
and thousands of duplicate records. Like today a table that should have had
a couple of thousand records ended up with over 800,000 records!!! When
this was de-duped we were back to a couple of thousand. This doesnt appear
to be an issue with the code. Firstly I have checked it and secondly this
only happens on the odd occasion. It is as if for some reason Access
repeats the same INSERT.. statement over and over and over again even though
there are no loops in the code that is being executed. Possibly this is to
do with recursive queries but even this doesnt seem to be the case based on
the logic the application uses.

Has anyone out there come across this issue or know of what could be causing
this?


Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.