Solved

populate combo box with Month Year

Posted on 2006-11-28
2
748 Views
Last Modified: 2008-01-09
hi,
May form_load event
Basically how can i populate combo box with values January 2006 to December 2006.
0
Comment
Question by:sikan71
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 200 total points
ID: 18032938
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
 

Author Comment

by:sikan71
ID: 18033202
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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now