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

populate combo box with Month Year

hi,
May form_load event
Basically how can i populate combo box with values January 2006 to December 2006.
0
sikan71
Asked:
sikan71
1 Solution
 
Rey Obrero (Capricorn1)Commented:
place this codes in the form's module

Function FillDate() As String
Dim dDate, j, tDate
dDate = 1  & "/" & 1 & "/" & Year(Date)
For j = 0 To 11
    tDate = tDate & ";" & Format(DateAdd("m", j, dDate), "mmmm yyyy")

Next
    FillDate = Mid(tDate, 2)
End Function

in the load event of the form

private sub form_load()

me.comboName.RowSourceType = "Value list"
me.comboName.RowSource = FillDate()

end sub
0
 
sikan71Author Commented:
Now, how do i insert this selected value into the table.
tablename: tblMethadone
fieldname: Month

I have ten different facility listed in the table.  On the form I have combo box for facility.  If combo box for facility equal table facility then i want to insert this selected item of cmbMonth into the table.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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