jlathem
Technical User
- Jul 25, 2010
- 27
Can someone take a look at this code and let me know what I am doing wrong?
I am trying to create a dynamic list of values for a Combo Box to list week numbers from the Start_Week to the End_Week and display each week number in the combo box as an option to select.
Any help is much appreciated,
James
I am trying to create a dynamic list of values for a Combo Box to list week numbers from the Start_Week to the End_Week and display each week number in the combo box as an option to select.
Any help is much appreciated,
James
Code:
Private Sub Combo_Week_Number_GotFocus()
'Declare Variables
Dim Start_Week As Integer
Dim End_Week As Integer
Dim counter As Integer
'Give Variables Value
Start_Week = DatePart("ww", #9/1/2010#, [vbSaturday], [vbFirstJan1])
End_Week = DatePart("ww", Now(), [vbSaturday], [vbFirstJan1])
'Create Loop
For counter = Start_Week To End_Week
Me.Combo_Week_Number = counter
Next
End Sub