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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats causing this error?

Status
Not open for further replies.

AndyApp

Programmer
Dec 20, 2001
259
0
0
GB
Hi,

When I run the code below I get the error: "Not allowed while object is closed" on the line 'while not rs1.EOF'. If I put 'rs1.open' I get "Not allowed when referencing a bad connection". I have had this once before and it was simply that I had missed the word 'set' from the begining of the line 'rs1 = SearchFNC'.

the code:

<SCRIPT LANGUAGE=vbscript RUNAT=Server>
function doGetFields1()

'This calls the search record DLL searching on the
'value of the input box above.
set SearchDLL = server.CreateObject &quot;prjQandAUpgradeDLLs.clsSearch&quot;)

'This IF statement checks to see if the user has
'checked the 'Jobs Completed' tick box
'if they have it uses a different DLL to search for
'jobs that are completed only, otherwise
'it looks up all jobs.
if (Jobs.getChecked()) Then Set SearchFNC = SearchDLL.SearchOnDateInputCompletedJobs(txtValue)
Else
Set SearchFNC = SearchDLL.SearchOnDateInput(txtValue)
End IF

Set rs1 = SearchFNC

strCurrentReferenceNumber = rs1.Fields(&quot;RefNumber&quot;).Value

Dim MyArray(8) 'First creat an array
'Within this Array we have to build a link to the
'worklogger page passing through
'the reference number, if the user wants all jobs or just
'completed jobs and another
'variable called function which is always set to true.
MyArray(0)=&quot;<A HREF='worklogger.asp?RefNo=&quot;
MyArray(1)=(rs1(&quot;RefNumber&quot;))
MyArray(2)=&quot;&Jobs=&quot;
MyArray(3)=(Jobs.getChecked())
MyArray(4)=&quot;&Function=True&quot;
MyArray(5)=&quot;'>&quot;
MyArray(6)=(rs1(&quot;RefNumber&quot;))
MyArray(7)=&quot;</A>&quot;

Dim strSentence 'Create a string
strSentence = join (MyArray) 'Join all the array parts into
'the string
Session(&quot;RefNoLink&quot;) = strSentence 'pass this string into a
'session variable

Dim MyArray1(2)
MyArray1(0)=(rs1(&quot;MemberInitials&quot;))
MyArray1(1)=(rs1(&quot;MemberSurname&quot;))
Dim strSentence1
strSentence1 = join (MyArray1)
Session(&quot;MemberName&quot;) = strSentence1

if IsNull(rs1(&quot;DateInput&quot;)) = False Then Session(&quot;DateInput&quot;) = rs1(&quot;DateInput&quot;)
if IsNull(rs1(&quot;Client&quot;)) = False Then Session(&quot;Client&quot;) = rs1(&quot;Client&quot;)
if IsNull(rs1(&quot;AllocatedTo&quot;)) = False Then Session(&quot;AllocatedTo&quot;) = rs1(&quot;AllocatedTo&quot;)

end function
</SCRIPT>
.
.
.
<TABLE BORDER=&quot;1&quot; CELLSPACING=&quot;0&quot; CELLPADDING=&quot;0&quot; WIDTH=&quot;100%&quot;>
<%
'Loop through records adding one row to the table for each record.
while not rs1.EOF
%>
<TR>
<TD WIDTH=&quot;50%&quot;>Reference Number:</TD>
<!--
Below is the session variable created at the top of the
page this is displayed as a link here. We could have
created the link here but we didn't.
//-->
<TD WIDTH=&quot;50%&quot;><%Response.Write(Session(&quot;RefNoLink&quot;))%></TD>
</TR>
<TR>
<TD WIDTH=&quot;50%&quot;>Member Name:</TD>
<TD WIDTH=&quot;50%&quot;><%Response.Write(Session(&quot;MemberName&quot;))%></TD>
</TR>
<TR>
<TD WIDTH=&quot;50%&quot;>Date Input:</TD>
<TD WIDTH=&quot;50%&quot;><%Response.Write(Session(&quot;DateInput&quot;))%></TD>
</TR>
<TR>
<TD WIDTH=&quot;50%&quot;>Client:</TD>
<TD WIDTH=&quot;50%&quot;><%Response.Write(Session(&quot;Client&quot;))%></TD>
</TR>
<TR>
<TD WIDTH=&quot;50%&quot;>Allocated To:</TD>
<TD WIDTH=&quot;50%&quot;><%Response.Write(Session(&quot;AllocatedTo&quot;))%></TD>
</TR>
<%
rs1.MoveNext
wend
%>
</TABLE>

Anyone any ideas? &quot;Life is like a Ferrari, it goes to fast.
But that's ok, because you can't afford it anyway&quot; - Jim Davis (Garfield)
 
this line in your code is missing a bracket...

set SearchDLL = server.CreateObject &quot;prjQandAUpgradeDLLs.clsSearch&quot;)

Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Tony,

Sorry it is missing a bracket on this snippet but not in the actual code. Sorry just a typo. &quot;Life is like a Ferrari, it goes to fast.
But that's ok, because you can't afford it anyway&quot; - Jim Davis (Garfield)
 
I'm not sure but I didn't see anywhere in your code where you actually opened the recordset rs1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top