Help!!! Brain Dead

javajom

Javajon
Local time
Today, 09:26
Joined
Mar 5, 2008
Messages
37
Hi,
Having one of those days, code won't work and nor does my office help. I quite new to this and having problem with my loop.

PHP:
name = Forms!orpheus.Type.Value
If (type1(run)) <> name Then
While type1(run) <> name
tp1 = (sales1(run))
tp2 = (purchasing1(run))
tp3 = (firstFix1(run))
tp4 = (paint1(run))
tp5 = (secondFix1(run))
tp6 = (test1(run))
tp7 = (despatch1(run))
End If
Wend

When I run it, it tells me End If without Block If. What must I do to get it to work? Please help???
 
how will this ever get out of the while wend loop
 
Good point! It won't. Since nothing in the posted code changes the value of (type1(run)), eliminate the While and Wend lines so that the code runs just once.

Bob
 
Last edited:
Perhaps the parameter "run" is passed by reference?
Then it could end.
 
Hi,

Here's an example of a Do While Loop, Perhaps this will help:

Do...Loop Statement Example
This example shows how Do...Loop statements can be used. The inner Do...Loop statement loops 10 times, sets the value of the flag to False, and exits prematurely using the Exit Do statement. The outer loop exits immediately upon checking the value of the flag.

Dim Check, Counter
Check = True: Counter = 0 ' Initialize variables.
Do ' Outer loop.
Do While Counter < 20 ' Inner loop.
Counter = Counter + 1 ' Increment Counter.
If Counter = 10 Then ' If condition is True.
Check = False ' Set value of flag to False.
Exit Do ' Exit inner loop.
End If
Loop
Loop Until Check = False ' Exit outer loop immediately.

John
 

Users who are viewing this thread

Back
Top Bottom