less-than criteria not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that I'm using to compile a YTD report. I have a user enter
the time frame they'd like to see and I'm using a query to pull everything
that is equal to or less than the month the user picks.

Here is my where statement:

WHERE ((([qry for report 2].[Commonality Dr
Name])=[Forms]![mainform]![cmbDrname]) AND (([qry for report
2].Month)<=([Forms]![mainform]![month])) AND (([qry for report
2].Year)=Right([Forms]![mainform]![cmbAlldate],4)));

The less-than won't work. I can change it to >=, >, =, and it works. I
can't see why <= isn't working.

Any help would be greatly appreciated.
 
Month and Year are both reserved words, and you shouldn't be using them for
anything you name yourself, but that doesn't explain why it works in some
cases but not others.

What's the data types of Month? If it's text, does it have preceding zeroes
or not (and does [Forms]![mainform]![month])?
 
the data type if fixed, 0 decimal places.

Douglas J. Steele said:
Month and Year are both reserved words, and you shouldn't be using them for
anything you name yourself, but that doesn't explain why it works in some
cases but not others.

What's the data types of Month? If it's text, does it have preceding zeroes
or not (and does [Forms]![mainform]![month])?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Becky Lazar said:
I have a query that I'm using to compile a YTD report. I have a user enter
the time frame they'd like to see and I'm using a query to pull everything
that is equal to or less than the month the user picks.

Here is my where statement:

WHERE ((([qry for report 2].[Commonality Dr
Name])=[Forms]![mainform]![cmbDrname]) AND (([qry for report
2].Month)<=([Forms]![mainform]![month])) AND (([qry for report
2].Year)=Right([Forms]![mainform]![cmbAlldate],4)));

The less-than won't work. I can change it to >=, >, =, and it works. I
can't see why <= isn't working.

Any help would be greatly appreciated.
 
Back
Top