I am attemping to use DatePart("YYYY",Now());DatePart("YYYY",Now())-1 etc to set the Row Source property of a List Box. Is there any way to write this function in designer or do I have to use a callback or some other functionality?
Function ListYears(fld As Control, id As Variant, _
row As Variant, col As Variant, code As Variant) _
As Variant
Dim intOffset As Integer
Select Case code
Case acLBInitialize ' Initialize
ListYears = True
Case acLBOpen ' Open
ListYears = Timer ' Unique ID
Case acLBGetRowCount ' Get rows
ListYears = 2
Case acLBGetColumnCount ' Get columns
ListYears = 1
Case acLBGetColumnWidth ' Get column width
ListYears = -1 ' Use default width
Case acLBGetValue ' Get the data
ListYears = DatePart("YYYY", Now()) - 1 * row
End Select
End Function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.