combo box to show 6 MonthName from September

Ksabai

Registered User.
Local time
Today, 11:13
Joined
Jul 31, 2017
Messages
104
I Have written the Following Code:

Private Sub Form_Activate()

Dim x As Integer
Dim m As Integer
m = Month(Date)
With Me.cmbShip01
Me.cmbShip01.Value = Null
For x = m To 12
.AddItem MonthName(x)
Next
End With
End Sub

This Populates Month Names from the Current Month Till December or MonthName(12)

What i want is to Show only Six Months from current Month i.e from September 2019 i want to show Till March 2020.

Can Anyone Help
 
Code:
Public Sub testExists()
   Dim x As Integer
   Dim dtmDate As Date
   dtmDate = Date
   For x = 1 To 12
     Debug.Print Format(DateAdd("m", x, dtmDate), "MMM YYYY")
   Next x
End Sub
 
Code:
 For x = 0 To 11
Probably want the current month included.
 
One thing to note. DateAdd will not return an invalid date. So if I add a month to today
1/30/2019 it returns 2/28/2019 and not 2/30/2019.
 
Yes it Worked


Just Finished the Work


Thanks Everyone
 

Users who are viewing this thread

Back
Top Bottom