PC Review


Reply
Thread Tools Rate Thread

3022 error while run update SQL

 
 
iccsi
Guest
Posts: n/a
 
      13th May 2010
I use CurrentDb.Execute strMYSQL, dbFailOnError to run my update
query.

I got run time error 3022 which is duplicate records found.
I tried to update multi records from the code.

I use following code to filter out the error, MS Access only updates
the first record.

Err_Handle:
Select Case Err
Case 3022
Resume Exit_Handle
Case Else
strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number) &
vbCrLf
strErrMsg = strErrMsg & "Error Description: " &
Err.Description
Resume Exit_Handle
End Select

I would like to know is it possible to update mutli records using VBA
code like CurrentDB.Execute


Your help is great appreciated,
 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      13th May 2010
"iccsi" <(E-Mail Removed)> wrote in message
news:b014425f-ea6b-4196-9743-(E-Mail Removed)...
>I use CurrentDb.Execute strMYSQL, dbFailOnError to run my update
> query.
>
> I got run time error 3022 which is duplicate records found.
> I tried to update multi records from the code.
>
> I use following code to filter out the error, MS Access only updates
> the first record.
>
> Err_Handle:
> Select Case Err
> Case 3022
> Resume Exit_Handle
> Case Else
> strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number) &
> vbCrLf
> strErrMsg = strErrMsg & "Error Description: " &
> Err.Description
> Resume Exit_Handle
> End Select
>
> I would like to know is it possible to update mutli records using VBA
> code like CurrentDB.Execute



Are you *updating* multiple records, which is no problem at all for an
UPDATE query, or ar you *inserting* multiple records with an append query,
and want duplicates to be ignored? If you're getting error 3022, I think
you must be inserting records, not updating them, unless you are running an
update query that changes the value of a unique key.

If you are running an append query, you can remove the "dbFailOnError"
argument and I believe the non-duplicate records will be appended. That is,
instead of:

> CurrentDb.Execute strMYSQL, dbFailOnError


.... use:

CurrentDb.Execute strMYSQL

I'm not sure if that works with an update query or not.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
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
Error 3022 Pietro Microsoft Access 0 15th Jul 2008 02:38 PM
Error 3022 =?Utf-8?B?SmFuaXMgaW4gTWlubmVzb3Rh?= Microsoft Access Forms 3 2nd Oct 2006 06:34 PM
Getting error 3022 trying to add record =?Utf-8?B?cmljaGFyZGI=?= Microsoft Access VBA Modules 6 13th Dec 2005 03:29 PM
Run-Time Error 3022 =?Utf-8?B?UmFscGggUm90dGVu?= Microsoft Access VBA Modules 4 16th Nov 2004 06:32 PM
Error 3022 vcapy Microsoft Access Forms 0 4th Aug 2003 08:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:37 PM.