combo box as query criteria issue

WineSnob

Not Bright but TENACIOUS
Local time
Today, 13:12
Joined
Aug 9, 2010
Messages
211
I have two combo boxes on a form [StartMonth] and [EndMonth] the controls are unbound and using 2 column row source with it bound to column 1. Column 1 is the month number 1,2,3 etc.
I am using the values to return records from a query using the criteria

Between [Forms]![frmMiscExpenseInput]![startmonth] And [Forms]![frmMiscExpenseInput]![endmonth]

the field is an expression using the ExpDate field (which is a date) 1/1/2011, 2/4/2011,12/6/2011, etc.
Here is how I have the filed defined:

xMonth: Format([ExpDate],"m").

I am getting wierd results. If I pick startmonth (Jan or 1) and EndMonth (Sept or 9) I get all 12 months records. If I pick each month as a start and end month it works fine. If I pick startmonth (Jan or 1) and EndMonth (Feb or 2) I get Jan, Feb,Oct,Nov and Dec. I always get Oct, Nov, and Dec when I chose a range when StartMonth is Jan or 1.

It is like the xMonth: Format([ExpDate],"m") "m" part is only seeing the first number 1, 10, 11, 12.

I have tried xMonth: Format([ExpDate],"mm") and get no results.
I must have something wrong here. The query works fine when I type in the criteria parameters Between 1 and 9. I get Jan thru Sept.

Is there another way to get the month value from a date field [ExpDate]?
 
Perhaps Month(ExpDate).
 
Nope.... does the same thing.
 

Users who are viewing this thread

Back
Top Bottom