Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2008-06-23
1
6,467 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
ID: 21853649
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

838 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