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!

'do' without 'loop' error - freakish!!! 1

Status
Not open for further replies.

joebankz

Programmer
Jun 13, 2001
8
0
0
US
I will tell you now, I have a Do while part and a loop part. what the heck could be wrong?

The code can be seen at work at
Here is the part of my code in question:

Code:
Sub CalendarList
	Set conn0 = Server.CreateObject("ADODB.Connection")
		conn0.open DB_CONN
	Set info = conn0.execute(&quot;select * from calendar where dowID = '&quot; & WeekDay(CurrentDate) & &quot;' AND &quot; & SQLdate & &quot; >= StartDate AND &quot; & SQLdate & &quot; <= EndDate order by time asc&quot;)

Do While Not info.eof
'Assign logical names to data types(info)
StartDate = info(0)
title = info(1)
StartTime = info(2)
blurb = info(3)
Description = info(4)
to_bring = info(5)
catID = info(6)
locID = info(7)
ID = info(8)
dowID = info(8)
EndDate = info(9)
EndTime = info(10)
RepID = info(11)
'RepId = 1 (means yearly)
'  &quot;   = 2 (means monthly)
'  &quot;   = 3 (means weekly)
If RepID = 1 And SQLdate = StartDate Then
Call Dates
ElseIf RepID = 2 Then
	If DayOfMonth = 1 AND Day(CurrentDate) <= 7 Then
	Call Dates
	ElseIf DayOfMonth = 2 AND Day(CurrentDate) > 7 AND Day(CurrentDate) <= 14 Then
	Call Dates
	ElseIF DayOfMonth = 3 AND Day(CurrentDate) > 14 AND Day(CurrentDate) <= 21 Then
	Call Dates
	ElseIf DayOfMonth = 4 AND Day(CurrentDate) > 21 AND Day(CurrentDate) <= 28 Then
	Call Dates
	ElseIf DayOfMonth = 5 AND Day(CurrentDate) > 28 AND Day(CurrentDate) <= 31 Then
	Call Dates
	ElseIf DayOfMonth = 0 AND Day(CurrentDate) = Day(StartDate) Then
	Call Dates
	End If
ElseIf RepID = 3 Then
Call Dates
	  info.MoveNext
Loop

		conn0.close
	Set conn0 = Nothing
End Sub
 
Have you tried changing it to a Do/Until loop?

Do Until info.eof
'Assign logical names to data types(info)
StartDate = info(0)
title = info(1)
StartTime = info(2)....


Hope that helps,
Jisoo22

 
search your entire page for &quot;do&quot; -- using the find feature of your editor.

There has to be another instance of it somewhere that you accidentally put in without a loop statement to close it. It's the only thing that would throw that error.

penny.gif
penny.gif
 
If I've left something out it would be a 'loop' not a 'do'. However, I tried what you said. I looked for 'do' and for 'loop'. I used the find feature of Dreamweaver. It didn't find any extra loop statements or do statements. This is just weird.
 
This is always mis-matched scope. Use proper indentaion and you will see it at once.
Code:
Do While Not info.eof
.............
    If RepID = 1 And SQLdate = StartDate Then
        Call Dates
    ElseIf RepID = 2 Then
        If DayOfMonth = 1 AND Day(CurrentDate) <= 7 Then
            Call Dates
        ElseIf DayOfMonth = 2 AND Day(CurrentDate) > 7 AND Day(CurrentDate) <= 14 Then
            Call Dates
        ElseIF DayOfMonth = 3 AND Day(CurrentDate) > 14 AND Day(CurrentDate) <= 21 Then
            Call Dates
        ElseIf DayOfMonth = 4 AND Day(CurrentDate) > 21 AND Day(CurrentDate) <= 28 Then
        Call Dates
        ElseIf DayOfMonth = 5 AND Day(CurrentDate) > 28 AND Day(CurrentDate) <= 31 Then
            Call Dates
        ElseIf DayOfMonth = 0 AND Day(CurrentDate) = Day(StartDate) Then
            Call Dates
        End If
    ElseIf RepID = 3 Then
        Call Dates
        info.MoveNext
    END IF ' MISSING END IF
Loop
 
JohnYingling,

Thanks for your input. In my actual page I have indented properly and corrected the missing End If. It still gives me the loop without do error.

HELP!
 
JohnYingling,

Thanks for your assistance! I figured out the problem. I had inserted the 'End If' as you had correctly stated before, but I inserted it after the 'Loop' bit. Therefore it was out of order and throwing the error.

Thanks again for your patient assistance!

Joe Banks
 
OK. Thanks for fighting on with it. When it is &quot;freakish&quot;, it &quot;possibly&quot; could be VB but it is &quot;probably&quot; VB programmer. Been there, done that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top