What do you mean by debug code? Can you give me an example?
You can turn on the Debug attribute for recordsets or query objects to see the actual error if you see:
"There is an error in your SQL syntax."
Then you can add:
$Recordset1->Debug = true;
before the line:
$Recordset->execute();