473,394 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Error In code - Do Loop

I trying to print the name of all the lists and the members of those list.
The code below works perfectly but it gives an error on the last listname

error '80020009'
/addeditdependentlists.asp, line 278

Can someone please help. The solution I have implemented is from the answer
provided by Phil W in my question "Basic Looping Question" on 3rd AUg 2005
at 11:59

thanks

<% strSQL = "SELECT DependentLists.id, DependentLists.ListName,
EMPProfile.Firstname, EMPProfile.Lastname "
strSQL = strSQL & " FROM (DependentLists LEFT JOIN
DependentListMembers ON DependentLists.Id=DependentListMembers.ListId) LEFT
JOIN EMPProfile ON DependentListMembers.Empname=EMPProfile.EmpName "
strSQL = strSQL & " ORDER BY DependentLists.ListName,
EMPProfile.Firstname; "

Set RSV = Server.CreateObject("ADODB.Recordset")
RSV.Open strSQL, conn, adOpenForwardOnly, adLockReadOnly, adCmdText
Do While Not RSV.EOF
prlistname = rsv("listname")
%>

<tr>
<td><%=rsv("ListName")%></td>
<td>
<table>

<%do while not rsv.eof and rsv("listname") = prlistname%> ' ******** THIS
IS THE LINE (278)

<tr>
<td><font face="Arial" size="2"><%=rsv("Lastname") & " " &
rsv("firstname")%></font></td>
</tr>
<%
rsv.movenext
Loop

%>
</table>
</td>

</tr>
<%
RSV.MoveNext
Loop

%>
</tbody>
</table>
<%
RSV.Close
Set RSV = Nothing
%>
Aug 4 '05 #1
1 1251
"JP SIngh" <no**@none.com> wrote in message
news:e6**************@TK2MSFTNGP10.phx.gbl...
I trying to print the name of all the lists and the members of those list.
The code below works perfectly but it gives an error on the last listname

error '80020009'
/addeditdependentlists.asp, line 278

Can someone please help.
The solution I have implemented is from the answer provided by Phil W


And I *apologise* for giving you Bad Code.

<excuse>I've been contaminated by .Net lately and forgot that
VBScript doesn't "short-circuit" If statements. </excuse>

You're problem is that when you hit the end of the recordset, you
/can't/ access any of the /items/ in the row, because there's no current
row any more!

This might work a little better :

Do While Not rsv.EOF
prlistname = rsv("listname")

Do While Not rsv.EOF
If prlistname <> rsv("listname") Then
' output List [heading] entry

prlistname = rsv("listname")
End If

' output member entry

. . .
rsv.MoveNext
Loop
Loop

HTH,
Phill W.
Aug 4 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: ale.of.ginger | last post by:
Greetings! I am trying to make a multiplayer (no AI, 2 person) game of tic tac toe in Python. So far it has been pretty simple. My only concern is with the win checking to see if a person has...
2
by: ColinWard | last post by:
whenever I run the following code I get an error saying that 'Trade Show and Conference Contacts database could not find the form 'Events_Form' referred to in a macro or in Visual Basic Code. The...
3
by: deko | last post by:
I have a logging routine that's supposed to silently log errors caught by error handler code on certain functions. The problem is sometimes stuff happens and the error handler can get caught in a...
4
by: OutdoorGuy | last post by:
Greetings, I am attempting to compile the code below, but I am receiving an error message when I do so. The error message is: "CSO161: 'Forloop.CalcAvg(int)': Not all code paths return a...
33
by: Anthony England | last post by:
I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on...
0
by: zfraile | last post by:
I'm getting this error from the JIT compiler at runtime, but only on my boss' machine, not my development machine. I believe the error is generated from a call to an Excel object, but I can't tell...
35
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks...
13
by: problem. | last post by:
#include <stdio.h> #include <stdlib.h> int main(void) { int a, b; float result = 0.0f; char symbol = '\0'; int loop = 0;
11
by: xenoix | last post by:
hey there, im reasonably new to C# and im currently writing a backup application which im using as a learning resource. My PC :- Visual Studio 2005 .NET Framework 2 Component Factory Krypton...
7
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.