Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incremental numbers for year fields

Status
Not open for further replies.

kjclark

Technical User
Feb 25, 2002
36
US
I am trying to make a field automatically populate additional fields with the incremental years.

For example: if the project start year is 2002, and the project lasts 10 years, how do I get the remaining year fields to automatically populate, 2003, 2004, 2005, etc for one record.

Any suggestions?

Thanks in advance!
Karla
 
In your combo box row source type put ListYears (don't use an equal sign) then
in the form code

Function ListYears(fld As Control, ID As Variant, row As Variant, col As Variant, code As Variant) As Variant

Select Case code
Case acLBInitialize ' Initialize.
ListYears = True
Case acLBOpen ' Open.
ListYears = Timer ' Unique ID.
Case acLBGetRowCount ' Get rows.
ListYears = 10 'This is the number of years
Case acLBGetColumnCount ' Get columns.
ListYears = 1
Case acLBGetColumnWidth ' Get column width.
ListYears = -1 ' Use default width.
Case acLBGetValue ' Get the data.

ListYears = DatePart("yyyy", Date) + row

End Select
End Function JHall
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top