PC Review


Reply
Thread Tools Rate Thread

Determining when an APPEND query fails

 
 
David C. Holley
Guest
Posts: n/a
 
      8th Feb 2005
I need to determine when an append query fails to append records to a
table. The data in question is collected remotely using a PPC and then
synch'd into a temporary table in the Access DB via ActiveSync, from
there the data is moved to the main table using an append query. If
there are any key violations, missing values, etc., I need to abort the
append.

David H
 
Reply With Quote
 
 
 
 
Marshall Barton
Guest
Posts: n/a
 
      9th Feb 2005
David C. Holley wrote:

>I need to determine when an append query fails to append records to a
>table. The data in question is collected remotely using a PPC and then
>synch'd into a temporary table in the Access DB via ActiveSync, from
>there the data is moved to the main table using an append query. If
>there are any key violations, missing values, etc., I need to abort the
>append.



Use the Execute method to run the query. It has an optional
dbFailOnError argument to do what you want.

It also set the object's RecordsAffected property so, if the
query runs successfully, you can find out how many records
were appended.

--
Marsh
MVP [MS Access]
 
Reply With Quote
 
David C. Holley
Guest
Posts: n/a
 
      10th Feb 2005
Actually, you got me thinking (as well as the DAO vs. ADO thread) about
moving the records via DAO single-row processing as opposed to the
entire batch via SQL. There's some additional processing that's needed
already AND it will allow me to add some polishing to it as well.

David H


Marshall Barton wrote:
> David C. Holley wrote:
>
>
>>I need to determine when an append query fails to append records to a
>>table. The data in question is collected remotely using a PPC and then
>>synch'd into a temporary table in the Access DB via ActiveSync, from
>>there the data is moved to the main table using an append query. If
>>there are any key violations, missing values, etc., I need to abort the
>>append.

>
>
>
> Use the Execute method to run the query. It has an optional
> dbFailOnError argument to do what you want.
>
> It also set the object's RecordsAffected property so, if the
> query runs successfully, you can find out how many records
> were appended.
>

 
Reply With Quote
 
Mark via AccessMonster.com
Guest
Posts: n/a
 
      10th Feb 2005
Along with the dbFailOnError feature of using the Execute method, you might
want to consider wrapping the Execute inside a transaction. This way, if
the append is successful, you can commit the transaction and finish the
append. If there was an error in the append, you can rollback the
transaction (in your error-handling routine) and none of the data will get
appended.

This assures and all-or-nothing append; otherwise, records will be appended
until the error occurs, and the rest won't.

--
Message posted via http://www.accessmonster.com
 
Reply With Quote
 
David C. Holley
Guest
Posts: n/a
 
      10th Feb 2005
I was thinking about approaching it as a transaction, even though I've
never actually used the technique before. I'm liking the idea of doing
things on a record-level since it would make it easier to see the
exceptions and correct them as opposed to having to dig through several
records looking for the problem. Even though the number of records will
be in 20-something range, I'd still like to get the ones that valid out
of the way first.

David H
Come on baby light my fire: www.SpreadFireFox.com

Mark via AccessMonster.com wrote:
> Along with the dbFailOnError feature of using the Execute method, you might
> want to consider wrapping the Execute inside a transaction. This way, if
> the append is successful, you can commit the transaction and finish the
> append. If there was an error in the append, you can rollback the
> transaction (in your error-handling routine) and none of the data will get
> appended.
>
> This assures and all-or-nothing append; otherwise, records will be appended
> until the error occurs, and the rest won't.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Append Query Fails Sash Microsoft Access Queries 2 6th Apr 2010 07:02 PM
Re: VBA code to loop append query fails John Spencer Microsoft Access VBA Modules 1 16th Mar 2009 09:18 PM
Random number append query fails, why? efandango Microsoft Access Queries 1 21st Dec 2008 02:01 AM
Append Query Fails, MS Access 2000 bug? DB_Newbie2007 Microsoft Access 5 7th Feb 2008 07:42 PM
Append query fails Don Microsoft Access Queries 6 14th May 2004 09:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:51 AM.