Error Handling a ADODB connection

I have a piece of code and an include file that manages errors - CheckForDbErrors.  I've artificially created an error in the code but can't seem to get it to call the error routine.  Here's the code:  Can you help?  I think it may have something to do with the line 'CheckForDbErrors (rsReceipt)'

**** the main code ********

On error resume next
Dim rsReceipt
Dim rsReceipt_numRows

Set rsReceipt = Server.CreateObject("ADODB.Recordset")
rsReceipt.ActiveConnection = MM_connDBA_STRING
rsReceipt.Source = "SELECT * FROM CustOrderReceipt WHERE OrID = " + Replace(rsReceipt__MMColParam, "'", "''") + ""
rsReceipt.CursorType = 0
rsReceipt.CursorLocation = 2
rsReceipt.LockType = 1

rsReceipt_numRows = 0
CheckForDbErrors (rsReceipt)

***  CheckForDBErrors include file ***

Sub CheckForDbErrors(objConn)
            'Used to check database calls
            'Errors means the count will be more than 0
            If objConn.error.count > 0 then
                  Dim cnDB,sSQL
                  Dim sEmailMsg
                  Dim vbCrLf
                  vbCrLf = Chr(13) + Chr(10)
                  Set cnDB = Server.CreateObject("ADODB.Connection")
                  cnDB.Open MM_connDBA_STRING
                  response.write("there's been and error")
                  sEmailMsg = "An Error occured at the site, Please find below " & _
                                          "the error details:-" & vbCrLf                  
                  For Each objError in objConn.Errors      
                        sSQL = "INSERT INTO [ErrorLog] (ErrorNo,ErrorDescp,ErrorSource) VALUES ('" & _
                                    Err.number & "','" & Err.Description & "','" & Err.Source & "')"
                        cnDB.Execute sSQL
                        sEmailMsg = sEmailMsg & "Error No    :" & Err.number & vbCrLf                              
                        sEmailMsg = sEmailMsg & "Error Desp  :" & Err.Description & vbCrLf
                        sEmailMsg = sEmailMsg & "Error Source:" & Err.Source & vbCrLf
                        sEmailMsg = sEmailMsg & "Error Time  :" & Now() & vbCrLf                        
                  SendTextMail "","",  _
                                          "","","Error(s) occured on the site",sEmailMsg
                  Set cnDB = Nothing
            end if
      End Sub
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rsReceipt is a recordset, and your error routine expects a connection object
you need to call CheckForDbErrors  and pass it a connection object instead of a recordset
try this:

Dim conn
set conn = CreateObject("ADODB.Connection") MM_connDBA_STRING

CheckForDbErrors (conn)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Why a B?? I pointed out the error and showed how to fix it, therefore completely answering the question
philwill4uAuthor Commented:
You answered the question but I thought excellent was for going beyond what's requested.  Good is for simply answering the question.  Excellent would be for say, showing an error routine for managing recordsets with no explicit connection defined.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.