Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

err.number within a loop

Status
Not open for further replies.

cawthor

Programmer
May 31, 2001
89
US
I have a loop that inserts a record on each iteration. I am checking the err.number value after each insert and writing any errors to a log file. Code as follows:

do while..
strSQL3 = "INSERT INTO....."
adoMaster.Execute strSQL3

If err.number Then
response.write err.Description
end if
loop

However, if one of the inserts fails, then all the remaining inserts will generate an error message (even though they are correctly inserted into the database). Does the 'err.number' variable retain it's values through each iteration? I thought performing an insert would reset these values to 0 or null if the insert was successful.

Thanks.
 
If that doesnt get it try adoMaster.Errors.Clear
 
once you get error and print it out once...you need to clear the err variable...so that in the next loop the if condition wont be true...

-DNG
 
Err.clear did the trick...thanks very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top