Re: QUERY CALCULATION BASED ON DATE RANGE?
- From: Phil <phil_at_nhs@xxxxxxxxxxx>
- Date: Thu, 15 Jun 2006 18:12:31 -0700
> WHERE DueDate <=DateAdd(Date,"m,",-2) ? should read something like
WHERE ShipsInformation.[Date of Issue] <=DateAdd("m",-2,Date()),
and should be placed at the end of your SQL after the FROM line.
Two mistakes/potential problems. You got the syntax for DateAdd backwards, and you referenced an alias. Access does not always like it when you reference alias's, for purposes of criteria, sorting, etc. it is safest to reference the original field, not the alias.
Liam.M@xxxxxxxxxxxxxxxx wrote:
Hey guys,.
If someone could spare the time in helping me with this problem it
would be very much appreciated...and apologies if it seems like a very
basic questions, however, I do not possess the experience and knowledge
like many of the people on here, and very much appreciate your
assistance.
I need to modify my SQL Statement to filter out all the records that I
am not interest in, bascially I need this query only showing records
that fall within a certain Date range...based on my "DueDate"
field......
The SQL Statement is as follows:
SELECT ShipsInformation.[SBMA Number], ShipsInformation.[Vessel Name],
ShipsInformation.[IMO Number], ShipsInformation.[Date of Issue],
ShipsInformation.RecordID, ShipsInformation.[Date of Attendance],
DateAdd("yyyy",1,ShipsInformation.[Date of Issue]) AS [Due Date],
ShipsInformation.EmailAddress
FROM ShipsInformation;
Now I understand that I need to add a "WHERE" criteria for the date
section....I want this query to only show records that fall within the
next two months of the "Due Date"....so something along the lines of :
WHERE DueDate <=DateAdd(Date,"m,",-2) ?
If someone could please explain how I could implement such a Query it
would be much appreciated...
Kind Regards
Liam.
- Follow-Ups:
- Re: QUERY CALCULATION BASED ON DATE RANGE?
- From: Liam . M
- Re: QUERY CALCULATION BASED ON DATE RANGE?
- References:
- QUERY CALCULATION BASED ON DATE RANGE?
- From: Liam . M
- QUERY CALCULATION BASED ON DATE RANGE?
- Prev by Date: Re: Passing parameters on to subquries
- Next by Date: Re: 4+0 = 2 in Union query. Data lost.
- Previous by thread: QUERY CALCULATION BASED ON DATE RANGE?
- Next by thread: Re: QUERY CALCULATION BASED ON DATE RANGE?
- Index(es):
Relevant Pages
|