• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

while loop with multiple conditions

Hi,
I am developing a VB application in which i have to check 2 conditions on while loop

ex
while month(date1) <= month(date2) and year(date1) <= year(date2)
    .
    .
    date1 = dateadd("M",1,date1)
wend
but it is checking only the first condition but not the second. is there any way where i can loop with 2 conditions
regards
Rajeeva
0
rajeeva_nagaraj
Asked:
rajeeva_nagaraj
1 Solution
 
Chris BottomleyCommented:
That is your logic ... if you want both then use an or instead of and

note as soon as date1 month is = or > that date 2 it will stop because false nd true = false

while month(date1) <= month(date2) and year(date1) <= year(date2)
to
while month(date1) <= month(date2) or year(date1) <= year(date2)

Chris
0
 
rajeeva_nagarajAuthor Commented:
Thanks a lot
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now