473,651 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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'
/addeditdependen tlists.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.Firs tname, EMPProfile.Last name "
strSQL = strSQL & " FROM (DependentLists LEFT JOIN
DependentListMe mbers ON DependentLists. Id=DependentLis tMembers.ListId ) LEFT
JOIN EMPProfile ON DependentListMe mbers.Empname=E MPProfile.EmpNa me "
strSQL = strSQL & " ORDER BY DependentLists. ListName,
EMPProfile.Firs tname; "

Set RSV = Server.CreateOb ject("ADODB.Rec ordset")
RSV.Open strSQL, conn, adOpenForwardOn ly, adLockReadOnly, adCmdText
Do While Not RSV.EOF
prlistname = rsv("listname")
%>

<tr>
<td><%=rsv("Lis tName")%></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 1260
"JP SIngh" <no**@none.co m> wrote in message
news:e6******** ******@TK2MSFTN GP10.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'
/addeditdependen tlists.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
2684
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 won. At first it looked like it was working, but now it sometimes assigns a win when you enter an X or O (doesn't matter) on certain tiles (row 1, column 1 won't be an error, but row 2, column 3 will be...). If you can find the problem, I'd be...
2
1347
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 code I am running in the On_Click event of a button is as follows: --Code Start-- Private Sub cmdAddTeams_Click() On Error GoTo Err_cmdAddTeams_Click Dim VarItem As Variant, SpecStr As String, strSQL As String
3
15954
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 loop. Is there some way to send a break from VBA code to break out of the loop? Here's what the error handler code looks like: Private Function MyFunction On Error GoTo HandleErr
4
12991
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 value". Any idea as to what I'm doing wrong? I'm sure it's something simple. Thanks in advance! public class ForLoop
33
3142
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 that ID, otherwise it returns false. **I am not looking for comments on the usefulness of this function - it is only to demonstrate error handling** There are three versions of this code. David Fenton says under the earlier thread "DAO...
0
3230
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 why or what specific action on the object is causing it. We both are running version 2.0 of the .net framework with Office 2003 installed, though I am running XP and she has Win2000. Also, I do not get this error when running another sub in...
35
3770
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 gets about 3 or so. It also gets very awkward in nested loops, where you want to check for normal loop processing in the loop condition, not errors. Yes, you could put some generic exit flag in the loop condition, but when you're simply done if...
13
4728
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
5579
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 Tools Test PC :- .Net Framework 2
7
4435
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 surrendered to you. <%@ Language=VBScript%> <%Option Explicit%>
0
8275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8795
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8576
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.