This error usually occurs because the URL being imported by ImportFromUrl
has generated a run-time script error.
The script's reliance of session variables
is often the culprit as the content of session variables is not preserved when the script is invoked via ImportFromUrl.
Therefore, a code snippet such as
SQL = "select * from mytable where id = " & Session("id")
myRecorset.Open SQL, myConnection
is bound to generate a run-time script error as Session("id")
becomes empty thus rendering the SQL statement syntactically incomplete and causing the myRecordset.Open method to fail.
Another example is a session variable containing an object. The line
Set myObject = Session("myObject")
by itself causes a run-time script error as an object cannot be initialized from an empty variable.
Methods other than session variables should be used to pass data from a script calling ImportFromUrl to the script being imported,
such as URL parameters, for example: