Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object required - But there's nothing missing! 1

Status
Not open for further replies.

moxie249

Technical User
May 15, 2001
16
0
0
CA
Help! I am going crazy trying to figure out this problem! I am trying to display a page showing which facilities in a certain region have submitted their daily information, and which have not. Showing the ones who have submitted is straightforward, and it's working fine. The other half is not going so well. Here is the error I'm getting:

Microsoft VBScript runtime (0x800A01A8)
Object required
/cplcanada/dailyreports/regions.asp, line 92

Two things: It's not telling me what's required, and the error is supposedly on line 92. The </html> tag, the last line of code, is on line 91! I'm going nuts! Here's the code:

===========================================================
<% 'Declare all variables
dim conn, conn2
dim rs
dim rs2
dim strconn, strconn2
dim cmd
dim strSQL, strSQL2, strSQL3
dim TodaysDate
dim inUID
'On Error Resume Next
strconn = &quot;DRIVER=Microsoft Access Driver (*.mdb);DBQ=&quot; & Server.MapPath(&quot;fpdb/dailyreport.mdb&quot;)
%>
<html>

<head>
<title>Today's Regional Count</title>
</head>

<body>
<%
'Setup connection and recordset objects
set conn = server.createobject(&quot;adodb.connection&quot;)
conn.open strconn
set rs = server.createobject(&quot;adodb.recordset&quot;)

' Set SQL statement
TodaysDate=Date()
QueryRegion=request.querystring(&quot;region&quot;)
strSQL = &quot;select * from Results where currentdate =#&quot; & TodaysDate & &quot;# and region like '&quot; & QueryRegion & &quot;'&quot;
rs.Open strSQL,conn, adOpenStatic
if rs.EOF then
response.write&quot;<font face=verdana size=2>No facilities from this region have submitted their data today.</font>&quot;
'response.end
else
response.write&quot;<p><font face=verdana size=2><b>The following facilities from the selected region have submitted their Daily Report:</b></font></p>&quot;
response.write&quot;<table>&quot;
'Loop through the recordset displaying the search result
Do while Not rs.EOF
response.write&quot;<tr><td><font face=verdana size=2>&quot; & rs(&quot;facility&quot;) & &quot;</font></td>&quot;
response.write&quot;<td align=center><font face=verdana size=2>  <a href='display.asp?id=&quot; & rs(&quot;ID&quot;) & &quot;'>View Details</a></font></td></tr>&quot;
rs.moveNext
loop
response.write&quot;</table>&quot;

end if
rs.close
set rs=nothing

'Setup connection and recordset objects
set conn2 = server.createobject(&quot;adodb.connection&quot;)
conn2.open strconn
set rs2 = server.createobject(&quot;adodb.recordset&quot;)
' Set SQL statement
strSQL2 = &quot;SELECT FacilityName FROM Census WHERE Region='&quot; & QueryRegion & &quot;' AND FacilityName NOT IN (SELECT Facility FROM Results WHERE currentdate=#&quot; & TodaysDate & &quot;#)&quot;
'response.write strSQL2
'response.end
rs2.Open strSQL2,conn2, adOpenStatic


if rs2.EOF then
response.write&quot;<font face=verdana size=2>All of the facilities in this region have submitted their Daily Reports.</font>&quot;
'response.end
else
response.write&quot;<p><font face=verdana size=2><b>The following facilities from the selected region have not submitted their Daily Report...</b></font></p>&quot;
response.write&quot;<table><tr><td height=50> </td></tr>&quot;
'Loop through the recordset displaying the search result
Do while Not rs2.EOF
response.write&quot;<tr><td><font face=verdana size=2>&quot; & rs2(&quot;FacilityName&quot;) & &quot;</font></td></tr>&quot;
rs.moveNext
loop
response.write&quot;</table>&quot;
end if
rs2.close
set rs2 = nothing
%>

</body>

</html>

==========================================================

Any suggestions would be greatly appreciated!

TIA,
Brenda
 
QueryRegion=request.querystring(&quot;region&quot;)
Is this coming from another page or the url? if not, it's not defined and could cause a crash (could be the &quot;missing object&quot;).
That's my best guess. Try &quot;hard coding&quot; a value for QueryRegion and see if it works. If so, we've found the culprit.
If that's not it, look closely at your loops. That's how you could get line 92. you can response.write a value (hi there or something) in the middle of the loop to see how far it gets before crashing.
hth
mark

 
Hi there hithere,

Yes, this is coming from a different page. The Region variable is passed from the other page. From the code you can see that I've tried to write the SQL statement, and it comes through just fine. I've also tested the SQL in the Access database, and it's working fine.

I'll check the loops...

Thanks,
Brenda
 
not sure if this would cause that problem but you have an infinite loop in your second do while loop. you have Rs.MoveNext when it should be Rs2.MoveNext [pipe]
 
THANK YOU THANK YOU THANK YOU!!!! That did it.

I thought this one would finally send me 'round the bend.

It's amazing how you can look at something like that for hours and not notice something so simple.

Once again, in case I haven't made myself clear, Thank you!

Brenda

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top