Try to comment out sectionCode:

$rsRecordset.LockType = $adLockReadOnly
if @ERROR
exit @ERROR
endif

and try again. Also, for the error checks we'll need to know the line executed before the error lone triggered.

the function has been confirmed to work with MS Access and MS SQL Server, I don't have MySQL to test with.
_________________________
There are two types of vessels, submarines and targets.