
Listing Days And Months - I Found A Solution
Thanks for everyone posting their theories on how to get and display the
number of days based on which month is selected, but I actually found a
solution to my problem.
Create a project and place two combos on the form then place the following
code into the project:
Private Sub Combo1_Click ()
Dim i As Integer
Combo2.Clear
For i = 1 to DateDiff("d", DateValue(Combo1.Text & "/1/" & _
Format(Now(), "yyyy")), DateAdd("m", 1, Combo1.Text & _
"/1/" & Format(Now(), "yyyy")))
Combo2.Additem i
Next i
End Sub
Private Sub Form1_Load ()
Dim i As Integer
For i = 0 to 11
Combo1.Additem Format(DateAdd("m", i, DateValue("1/1/" & _
Format(Now(), "yyyy"))), "mmmm")
Next i
End Sub
This code will even account for Leap Years. Just try it, it does work.
Change your system date to the year 2000, 2004 and so on and select February
from the first combo. Then display the value in the second combo.
Darren O'Leary