G Guest Aug 18, 2007 #1 Can someone tell me how to populate a combo box with Formated Date of yyyy say from 1999 to current year
Can someone tell me how to populate a combo box with Formated Date of yyyy say from 1999 to current year
G Guest Aug 18, 2007 #2 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.
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.
G Guest Aug 18, 2007 #3 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 Click to expand...
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 Click to expand...
G Guest Aug 18, 2007 #4 Your quite welcome. Good luck with your project. Mr B askdoctoraccess dot com