Date from number

  • Thread starter Thread starter Newbie
  • Start date Start date
N

Newbie

I have a combo that is filled with 1 to 12 to represent months when running
a report.

I would like the title of the report to have the corresponding month ie.
Jan, Feb etc that corresponds to the number in the combo.

Is this possible with out using a select case is statement

eg
select case combo1
case is = "1"
month = "Jan"
End select
 
It shouldn't. If your combo contains the digits 1 through 12,
Format$(combo1, "mmm") will return Jan for every row in the combo.

This is because of how Access (and all other Office programs) store dates:
as 8 byte floating point numbers, where the integer portion represents the
date as the number of days relative to 30 Dec, 1899, and the decimal portion
represents the time as a fraction of a day.

To convert the digits 1 through 12 to dates so that you can use the Format
function on them, try:

Format$(DateSerial(2003, Combo1, 1), "mmm")
 
Thanks it works a treat -

I mistakenly thought that as it worked for 1 it was going to work for all of
them - no doubt I would have found out sooner or later . . .
 
Back
Top