Results 1 to 2 of 2

Thread: ADO Insert Error

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2001
    Posts
    40

    ADO Insert Error

    I am inserting several things into a database using an ADO Connection. There are several occasions where an unique record that I am attempting to insert is already present in the Database. This is as designed, and I wish for the insert to be attempted, then if there is a duplicate key an error will come back which I will ignore. The problem is that I have the following statement:

    On Error Resume Next

    I use this since I anticipate several items already being in the database that I wish to ignore. The problem is that when I get the error, the resume next never happens. The program halts as soon as I get the error. It also doesn't do it all the time, which is quite strange. Any ideas what is going on?

  2. #2
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    The resume next halt is logical. Usually you have not only one line of code to add an record. so the resume next goes in the next line of your code and try to do there what you write there to do, that means something that have to do with the new record (that was not created). Result: It cannot resume.

    If you have something like that then it is better to create a Sub and do this there and put in the errorhandler: exit sub


    BUT, normally it is not good to work with things like that because to use an errorhandler as a part of an normal code is not the idea of that. Try to avoid this.

    Franky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width