Exiting an if...then statement in vbscript
I'm trying to use an if...then statement within a for...next loop to check
at the outset whether or not a particular value is 0 or not. If it is 0
(zero), then I want to just exit the if...then statement which will, in theory,
go right to the 'next' part of the for...next loop and increment the counter.
Basically, how do I exit an if...then statement like:
FOR i = 1 TO somenumber
quantity = request.form("quantity")
IF quantity = 0 THEN
'exit the if...then statement
ELSE
'execute some code
END IF
NEXT
[589 byte] By [
Eric] at [2007-11-9 15:35:18]

# 1 Re: Exiting an if...then statement in vbscript
Either don't put anything between the IF and THEN, or use:
FOR i = 1 TO somenumber
quantity = request.form("quantity")
IF quantity <> 0 THEN
'execute some code
END IF
NEXT
--
Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/
Eric <ericj@newportinternet.com> wrote in message
news:390df1b3$1@news.dev-archive.com...
>
> I'm trying to use an if...then statement within a for...next loop to check
> at the outset whether or not a particular value is 0 or not. If it is 0
> (zero), then I want to just exit the if...then statement which will, in
theory,
> go right to the 'next' part of the for...next loop and increment the
counter.
>
> Basically, how do I exit an if...then statement like:
>
> FOR i = 1 TO somenumber
> quantity = request.form("quantity")
> IF quantity = 0 THEN
> 'exit the if...then statement
> ELSE
> 'execute some code
> END IF
> NEXT
>
>
>
>