Re: QUERY CALCULATION BASED ON DATE RANGE?
- From: Liam.M@xxxxxxxxxxxxxxxx
- Date: 15 Jun 2006 22:19:07 -0700
Apologies Phil....I have now fixed the problem....Kind Regards
Liam
p.s: thankyou so much for your assistance it is very much appreciated!
Lia...@xxxxxxxxxxxxxxxx wrote:
Hey Phil, thankyou so much for your prompt reply! I have tried to
implement this, however I am getting a few different error messages
My SQL Statement looks like this:
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],FROM
ShipsInformation; WHERE ShipsInformation.[Date of
Issue]<=DateAdd("m",-2,Date());
I once of two errors appearing...one: The SELECT statment includes a
reserved word or an argument name that is mispelled or missing, or the
punctuation is incorrect...or two: Characters found after SQL
Statment....any suggestions?
Regards
Liam
Phil wrote:
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.
.
- References:
- QUERY CALCULATION BASED ON DATE RANGE?
- From: Liam . M
- Re: QUERY CALCULATION BASED ON DATE RANGE?
- From: Phil
- Re: QUERY CALCULATION BASED ON DATE RANGE?
- From: Liam . M
- QUERY CALCULATION BASED ON DATE RANGE?
- Prev by Date: Re: QUERY CALCULATION BASED ON DATE RANGE?
- Next by Date: DateAdd Calculation?
- Previous by thread: Re: QUERY CALCULATION BASED ON DATE RANGE?
- Next by thread: 4+0 = 2 in Union query. Data lost.
- Index(es):
Relevant Pages
|