Solved

how to catch Run time error '-2147467529 (80004005)'

Posted on 2008-06-23
1
6,214 Views
Last Modified: 2013-12-25
i have a database and everytime when user tryinig to save a duplicate record , the error mesage should state
you can not save the record, because the record existed
I have :
rs!RecNum=txtrecnum.text
rs!AccountName=txtAccountName.text
rs!Name=txtName.text
if err.number=-2147467529 then
msgbox "you can not save the record, because the record existed"
exit sub
else
rs.update
end if
0
Comment
Question by:rfedorov
1 Comment
 
LVL 53

Accepted Solution

by:
Dhaest earned 250 total points
Comment Utility
Did you try something like this ? Can you tell me what goes wrong with your code ?

private sub SaveRecord()
on error goto myError
rs!RecNum=txtrecnum.text
rs!AccountName=txtAccountName.text
rs!Name=txtName.text
rs.update
exit sub
myError:
if err.number=-2147467529 then
    msgbox "you can not save the record, because the record existed"
end if
exit sub
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now