T
Tangz
I am trying to the list years in a combo box based on current year:
e.g: current year -2008
combo box values : 2007,2008,2009,2010,2011,2012
I found a function that calculates this value:
Function YearLoop() As String
Dim YearHold As Date
Dim strSQL As String
Dim i As Integer
Dim n As Integer
strSQL = ""
For i = -1 To 5
YearHold = DateSerial(Year(Date) + i, 1, 1)
strSQL = strSQL & Format(YearHold, "yyyy") & "; "
Next i
YearLoop = strSQL
End Function
I tried to call this function from the combo box by setting
RowSourceType to be YearLoop (I also tried =YearLoop) but the combo
box doesn't seem to be calling that function.
Can anyone suggest how to use the function YearLoop() to populate the
combo box.
Thanks
Thangam
e.g: current year -2008
combo box values : 2007,2008,2009,2010,2011,2012
I found a function that calculates this value:
Function YearLoop() As String
Dim YearHold As Date
Dim strSQL As String
Dim i As Integer
Dim n As Integer
strSQL = ""
For i = -1 To 5
YearHold = DateSerial(Year(Date) + i, 1, 1)
strSQL = strSQL & Format(YearHold, "yyyy") & "; "
Next i
YearLoop = strSQL
End Function
I tried to call this function from the combo box by setting
RowSourceType to be YearLoop (I also tried =YearLoop) but the combo
box doesn't seem to be calling that function.
Can anyone suggest how to use the function YearLoop() to populate the
combo box.
Thanks
Thangam