Combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone tell me how to populate a combo box with Formated Date of yyyy
say from 1999 to current year
 
Mike,

Place the following code in the OnOpen event of your form:

Dim strRowSource As String
Dim varCntr As Byte
Dim cntr

varCntr = Val(Year(Date)) - 1999
strRowSource = "1999"
For cntr = 1 To varCntr
strRowSource = strRowSource & "; " & Str(1999 + cntr)
Next cntr
With Me.cboYear
.RowSource = strRowSource
.Requery
End With

Change the Me.cboYear to the name of your combo box.
 
Thank You Mr.B

Mr B said:
Mike,

Place the following code in the OnOpen event of your form:

Dim strRowSource As String
Dim varCntr As Byte
Dim cntr

varCntr = Val(Year(Date)) - 1999
strRowSource = "1999"
For cntr = 1 To varCntr
strRowSource = strRowSource & "; " & Str(1999 + cntr)
Next cntr
With Me.cboYear
.RowSource = strRowSource
.Requery
End With

Change the Me.cboYear to the name of your combo box.
--
HTH

Mr B
askdoctoraccess dot com
 
Back
Top