Row Source - combo box, filtering what pops up in a combo box by date

Posted by primus285 on Stack Overflow See other posts from Stack Overflow or by primus285
Published on 2010-04-16T19:42:40Z Indexed on 2010/04/16 19:43 UTC
Read the original article Hit count: 328

Filed under:
|

so I have a combo box that I want to pop up when somebody wants to search by year. It will allow them to see in that combo box only results that happened in a certain year.

so far I have something like

SELECT DISTINCT Database_New.ASEC
FROM Database_New
WHERE (((Database_New.Date) >= DateValue('01/01/2001') 
AND  (((Database_New.Date) <= DateValue('12/031/2001')));

or

SELECT DISTINCT Database_New.ASEC
FROM Database_New
WHERE (((Database_New.Date) >= BETWEEN DateValue('01/01/2001') 
AND  DateValue('12/31/2001’)));

as you can see, the kicker is that I am already sorting the thing with SELECT DISTINCT under the ASEC field. But I want to filter it one more by year so a whole bunch of ASEC values that didnt happen in that year (and there are quite a few that happen rarely, or would onyl be associeted with one year) do not pop up as avalible.

so far I get an error like

"Syntax error in query expression '(((Database_New.Date) >= DateValue('01/01/2001') AND (((Database_New.Date) <= DateValue('12/031/2001')))'

and I am a VBA person, not quite as good at debuggin SQL.

Is it something easy?

or will it simply not work the way I have it set up.

© Stack Overflow or respective owner

Related posts about sql

Related posts about ms-access