Choosing Dates From Combo

S

SGTPEP

I am looking for a simple but effective way to select a month, in the format
"June 07", on a form.

Should i put the months in a table and use a combo box?

Thanks
 
S

Steve

Add a calendar control named Calendar to your form. That gives you the
ability to select any month in any year.You can then get what you want with:
Format(Me!Calendar.Value, "mmmm yy")

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
[email protected]
 
K

Klatuu

No, you should not use a table. I would not suggest a combo box, but if that
is what you want, here is a function that will return a string formatted so
it can be used as a value list row source for a combo. Pass it a date with
the first month/year you want to display, and the number of months you want
to display.

Public Function DateString(dtmStartFrom, lngMos) As String
Dim dtmAddDate As Date
Dim lngYears As Long

For lngYears = 0 To lngMos - 1
DateString = DateString & Format(DateAdd("m", lngYears,
dtmStartFrom), "mmm yy") & ";"
Next lngYears
DateString = Left(DateString, Len(DateString) - 1)

End Function
 
Top