Looping within Loops

Results 1 to 2 of 2

Thread: Looping within Loops

  1. #1
    Join Date
    Dec 1969

    Default Looping within Loops

    Hi, I have a problem at the moment with looping within loops.<BR><BR>I am basically wanting to loop from the current date to a date that the user defines (the easy bit !!). Inside this loop I am wanting to loop invalid dates (which are predefined by the site administrators). Outlined below is how the loops are set out, however I am struggling with only showing dates that are available :-(<BR><BR>[code language="VBScript"]<BR>&#039; Do the date to max book date loop<BR>For theDate = date() to maxBookDate<BR><BR>&#039; Loop through the invalid days array<BR>For x = 0 to uBound(rsArray, 2)<BR><BR>&#039; Move to next invalid day record<BR>Next<BR><BR>&#039; Loop to the next date<BR>Next<BR>[/code]<BR><BR>Any help on this one please :-)

  2. #2
    Join Date
    Dec 1969

    Default Keep it simple...

    For theDate = date() to maxBookDate<BR><BR> okay = True &#039; make an assumption<BR><BR> &#039; Loop through the invalid days array<BR> For row = 0 to uBound(rsArray, 2)<BR> If theDate = CDate( rsArray( SOME_COLUMN, row ) ) Then<BR> &#039; oops...a match on an invalid date, so...<BR> okay = False &#039; don&#039;t work on this date<BR> Exit For<BR> End If<BR> Next<BR> &#039; if still okay to work on theDate, then do so:<BR> If okay Then<BR> ... display or do whatever with theDate ...<BR> End If<BR><BR>Next<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts