MS Acess SQL - where clause to get year from date based on the year - data located in MS access form
- by primus285
OK, back again. I have a problem getting a drop down list to populate based on information in two fields.
I have got the SQL correct as to Select just one year if I put DateValue('01/01/2001') in both places, but I am trying now to get it to grab the year data from the MS access form - another drop down named "cboYear".
I'd hate to have to do something in VB, unless necessary.
so far I have gotten this to pull up something (its always incorrect)
SELECT DISTINCT Database_New.ASEC
FROM Database_New
WHERE Database_New.Date>=DateValue('01/01/' & [cboYear])
And Database_New.Date<=DateValue('12/31/' & [cboYear]);
and
SELECT DISTINCT Database_New.ASEC
FROM Database_New
WHERE Database_New.Date>=DateValue('01/01/' + [cboYear])
And Database_New.Date<=DateValue('12/31/' + [cboYear]);
SELECT DISTINCT Database_New.ASEC
FROM Database_New
WHERE Database_New.Date>=DateValue('01/01/' AND [cboYear])
And Database_New.Date<=DateValue('12/31/' AND [cboYear]);
both give errors saying that it is too complex to compute.
Its probably something simple, but where do I go from here?