HELP PLEASE!! error '80020009'
Help! I am really stuck with this problem.
I'm trying to do a loop through two recordsets, and it works perfectly if I use Response.Write on the individual values, but dies as soon as I try and make it a string.
Code is:
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open strCon
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.Open "SELECT * FROM tblOrders WHERE Invoiced = 'No' AND Shipped = 'Yes';",adoCon,1,2
Set rsInvoiceNumber = Server.CreateObject("ADODB.Recordset")
rsInvoiceNumber.Open "SELECT * FROM tblInvoiceNumber;",adoCon,1,2
intInvoiceNumber = rsInvoiceNumber("InvoiceNumber") + 1
Do While Not rs2.EOF
Set rs3 = Server.CreateObject("ADODB.Recordset")
rs3.Open "SELECT * FROM tblOrderDetails WHERE OrderID = " & rs2("ID") & ";",adoCon,1,2
Do While Not rs3.EOF
Set adoCustomerCon = Server.CreateObject("ADODB.Connection")
adoCustomerCon.Open strCon
Set rsCustomer = Server.CreateObject("ADODB.Recordset")
rsCustomer.CursorLocation = 3 'adUseClient
rsCustomer.CursorType = 3 'adOpenStatic
rsCustomer.ActiveConnection = adoCustomerCon
rsCustomer.Open "SELECT * FROM tblCustomerData WHERE ID = " & rs3("CustomerID") & ";"
Headers = ""
Headers = Headers & rsCustomer("CompanyName") & ","
The error is on Headers = Headers & rsCustomer("CompanyName") & ","
Yet, if I take out the Headers part and do Response.Write rsCustomer("CompanyName") it's fine????
Thanks
|