fullOfQuestions
fullOfQuestions

Reputation: 453

error '80020009' - But I'm not in a query

I have a system that places an order in ASP, and when an order is submitted, a notification email goes out.

When I submit the order, I get error '80020009' and the line it points to is this:

email_text = email_text & "<html>" & _

That's a simple line that just starts building the html string that fills the email! Isn't error '80020009' supposed to be for SQL statements? Or am I missing something?

The page still continues on and completes the order process, it just shows that error message first.

I realize this question doesn't really provide much detail, but I don't know what else to specify, I'm just at a loss.

EDIT: Here's some SQL that is a few lines up from that line. Not sure how this would cause the issue, since it's telling me it's on that email line, but it can't hurt to throw it in:

str = "SELECT creation_date, supplier FROM argus.PURCHASE_ORDER WHERE purchase_order = '" & Trim(Request.Form("order_id")) & "' AND customer = '" & Session("customer_id") & "' AND store = '" & Session("store_id") & "' AND userid = '" & Session("user_id") & "'"
            Set rst = ConnFW.Execute(str)
            str2 = "SELECT a.store_name, a.address1, a.address2, a.city, a.state_cd, a.zipcode, b.customer_name, c.supplier_account FROM argus.STORE a, argus.CUSTOMER b, argus.ELIGIBLE_SUPPLIER c WHERE a.customer = b.customer AND a.customer = c.customer AND a.store = " & Session("store_id") & " AND b.customer = " & Session("customer_id") & " AND c.supplier = " & Trim(rst("supplier")) & ""
            Set rst2 = ConnFW.Execute(str2)

Upvotes: 0

Views: 1128

Answers (1)

sgeddes
sgeddes

Reputation: 62831

Can you provide additional code? There isn't anything wrong with your code except you need to make sure you have something on the line following the underscore:

email_text = email_text + "<html>" & _
               ""

-- EDIT

Thanks for posting your edits. I see a couple potential issues. In your second recordset object, your trying to access rst("supplier"), but that field hasn't been read yet. Instead of using connfw.execute(str) which is used to execute sql statements like INSERT, UPDATE and DELETE, use rst.open which is used with SELECT.

Try something like:

supplier = ""

rst.open str, connfw

if not rst.eof then
   supplier = rst("supplier")
end if

rst.close

Then use supplier in your 2nd sql statement. Also, if the supplier field from the eligible_supplier table is a string, you need to wrap single quotes around that field in your where clause.

Upvotes: 2

Related Questions