convert a month to a number

LuigiCorleone

New member
Local time
Today, 22:52
Joined
May 14, 2002
Messages
7
Hi

I've got a combo box that displays the months of the year. I want to return a number from the selected month eg January returns 1, February returns 2 and so on..

Cheers

Luigi
 
Always check the Access help menu with you questions. Here's what you would have found:

This example uses the Month function to obtain the month from a specified date. In the development environment, the date literal is displayed in short date format using the locale settings of your code.

Dim MyDate, MyMonth
MyDate = #February 12, 1969# ' Assign a date.
MyMonth = Month(MyDate) ' MyMonth contains 2.
 
Thanks but maybe I didnt explain myself clearly enuf.

I want to match up by integer on both sides of a "where" clause thus:

WHERE (((DatePart('m',[tblSales]![SaleDate]))=[Forms]![frmSalesByMonth].[cmbMonth]));

At present the right hand side is returning a string - "January" etc from the combo box (cmbMonth) while the left side is returning an integer.

???

Cheers

Luigi
 
Make a hidden column in your combo. Reference that instead of the 'verbose' month name.
 

Users who are viewing this thread

Back
Top Bottom