How to make this loop?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PerryC

    #1

    How to make this loop?

    All,
    What am I doing wrong that it does not loop around employeeID?
    This will create dates for the 1st employeeID, but then it stops. I
    thought MoveNext goto the next Record (i.e. next employeeID) and then
    fill in the dates again until it populates all the employees with
    appropriate dates.

    *************** *************** *************** **
    While (Not emp.EOF)

    lngResourceID = emp![EmployeeID]

    While dblCurrentDate <= dblEndDate
    rstSchedule.Add New
    rstSchedule![EmployeeID] = lngResourceID
    rstSchedule![WorkDate] = dblCurrentDate
    rstSchedule.Upd ate

    dblCurrentDate = dblCurrentDate + 1
    Wend

    emp.MoveNext

    Wend

    *************** *************** *************** ***

    Sincerely,
    Perry
  • Bob Quintal

    #2
    Re: How to make this loop?

    perryche@yahoo. com (PerryC) wrote in
    news:ea92818f.0 405171119.6336b aab@posting.goo gle.com:
    [color=blue]
    > All,
    > What am I doing wrong that it does not loop around
    > employeeID?
    > This will create dates for the 1st employeeID, but then it
    > stops. I thought MoveNext goto the next Record (i.e. next
    > employeeID) and then fill in the dates again until it
    > populates all the employees with appropriate dates.
    >
    > *************** *************** *************** **
    > While (Not emp.EOF)
    >
    > lngResourceID = emp![EmployeeID]
    >
    > While dblCurrentDate <= dblEndDate
    > rstSchedule.Add New
    > rstSchedule![EmployeeID] = lngResourceID
    > rstSchedule![WorkDate] = dblCurrentDate
    > rstSchedule.Upd ate
    >
    > dblCurrentDate = dblCurrentDate + 1
    > Wend
    >
    > emp.MoveNext[/color]

    'you need to reset dblCurrentDate
    'to the starting date here so that
    'the while will work for the second
    '(and subsequent) employee.
    dblCurrehntDate = dblStartDate


    [color=blue]
    > Wend
    >
    > *************** *************** *************** ***
    >
    > Sincerely,
    > Perry
    >[/color]

    Bob Quintal

    Comment

    • Perry Cheng

      #3
      Re: How to make this loop?


      That seems to be so obvious and I have read it again and again... and
      yet missing that... Thank you Bob.



      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...