beanbeanbean
12-11-2008, 06:33 PM
Hi guys,
i was just wondering if dates can be included in a query.
the query i'm trying to write now is this,
currently i have a date which is in YYYY-MM-DD, lets call this the creation date.
what i am trying to pull out from the whole database are dates which are outside 20-June-2008 and 31-Oct-2008. This means is my date is 19-June-2008 or less and 1st-Nov-2008 or more, its would be shown on the table.
is there a way to write a query for this ? i tried writing the dates into the query and they somehow don't work.
pbaldy
12-11-2008, 07:17 PM
Try
WHERE DateField < #6/20/08# OR DateField > #10/31/08#
beanbeanbean
12-11-2008, 11:14 PM
hey pbaldy.
i tried your version of the code and soehow it still pulls dates that are in the range.
i only want dates that are outside the range. is there other way of writing the code ?
DCrake
12-11-2008, 11:43 PM
Have you placed the criteria on the same row in your query?
Try putting the different options one underneath the other in the grid.
Anything in one line Access assumes an implied AND by putting on different rows Access implies OR
David
beanbeanbean
12-12-2008, 12:00 AM
Hi DCrake,
yes i put them in different rows from the beginning. my code looks like this.
SELECT [cases of tron final].[Opty Id], [cases of tron final].[Opty Name], [cases of tron final].[Contact CIN], [cases of tron final].[Contact CIN SFX], [cases of tron final].[Create By (Name)], [cases of tron final].[Created By (Login)], [cases of tron final].[Opty Created Date], [cases of tron final].[Opty Closed Date], [cases of tron final].[Closed By (Emp #)], [cases of tron final].[Referral - Employee #], [cases of tron final].[Referral - Employee], [cases of tron final].[Sales Rep], [cases of tron final].Product
FROM [cases of tron final]
WHERE (([cases of tron final].[Opty Created Date]) < #6/20/08#)
AND (([cases of tron final].[Opty Created Date]) > #10/31/08#);
is there anything wrong with it ?
it still pulls out dates like: 2008-07-17
this date is between 20-6-08 and 31-10-08
pbaldy
12-12-2008, 06:30 AM
I don't see how it could pull anything with the AND; it's impossible for a date to meet both conditions. Is that really a date field?