How do I loop with this code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • troy_lee@comcast.net

    How do I loop with this code

    Here's what I have so far...

    Private Sub Text4_AfterUpda te()
    Dim dtmWeek1BegDate As Long
    Dim dtmWeek1EndDate As Long
    Dim intWeekNumber As Integer

    ' Text4 is the beginning day of the month which will equal the
    first day of the first week.
    dtmWeek1BegDate = Me!Text4
    Me!Text8 = dtmWeek1BegDate

    dtmWeek1EndDate = DateAdd("d", 6, dtmWeek1BegDate )
    Me!Text10 = dtmWeek1EndDate

    intWeekNumber = 1
    Text6 = "Week " & intWeekNumber


    End Sub

    The user will start a new form each month. They are asked to provide
    the month name and year, the beginning day of the month and how many
    weeks will be in this month (4 or 5 are the only acceptable choices).

    I want to loop this code so that the correct number of weeks are
    created for the month as put in by the user . The rest of the weeks'
    variables are not shown, but I will need a beginning and end date for
    each week (these will provide parameters for my queries). In addition,
    I need to increment the intWeekNumber variable so that it counts up to
    and returns the sequential number for the number of weeks required by
    the user.

    I hope this makes sense. Thanks for the help in advance.

    Troy
Working...