• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

Populate Months in drop down

How do I populate a drop down as follows:

1-January
2-February
3-March
etc.

Currently I have:
            'Pop month
            For i = 1 To 12
                cboMonth.Items.Add(i & "-" & Format(Now.AddMonths(i - 4), "MMMM"))
                cboMonth.Items.FindByText(i & "-" & Format(Now.AddMonths(i - 4), "MMMM")).Value = i
            Next

But ofcourse this is wrong. Thanks
0
wilcor14
Asked:
wilcor14
  • 2
1 Solution
 
Jai STech ArchCommented:
       For i = 1 To 12
            ComboBox1.Items.Add(i & "-" & MonthName(i, True))
        Next
0
 
Jai STech ArchCommented:
the prev example will show you jan,feb etc..
this one will give you the full monthname
        For i = 1 To 12
            ComboBox1.Items.Add(i & "-" & MonthName(i, False))
        Next
0
 
wilcor14Author Commented:
Thanks jaiganeshsrinivasan for you time. It works perfectly.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now