G
Guest
More date related problems in ACCESS 2003
My table has a Date field called "DiveDate" where we store the date a dive
was done and a Date field called "DateChart" where we store the date the
chart pertaining to that dive was received. I need to track that all charts
are received within 28 days following the end of the month the dive took
place.
I use 2 query
In the first query, I have a function that allows me to figure out the last
day of the month for that date and i add 28 days so i know the date i should
have received the chart. It looks like this:
DueDateChart: DateAdd("d",28,(lastofMonth([HarvestDate])))
Everything works beautifully.
I use that query as an input to the second query that i need to know how
many days elapsed between the duedatechart and the day the dive took place.
The calculation I do looks like this:
WaitDays: DateDiff("d",[duedateChart],[DateChart])
It works beautifully. The waitDays show positive numbers if chart were sent
in the allowed time frame , and minus numbers when they were not. All i need
are the Minus number. But i can't get that part to work.
If is use a criteria of > 0 in the waitDays column, i get the message: "you
tried and execute a query that doesn't include the specified expression
datedif etc..
as part of an aggregate function".
So I try adding a WHERE clause and the error message now reads:
"DataMismatch in Criteria expression"
The SQL with the WHERE clause is:
if I add a where clause so now the SQL is
SELECT qryChartDueDate.Vessel, qryChartDueDate.Tab,
qryChartDueDate.DiveDate, qryChartDueDate.DateChart,
qryChartDueDate.DueDateChart, DateDiff("d",[duedateChart],[DateChart]) AS
WaitDays
FROM tblLicense INNER JOIN qryChartDueDate ON tblLicense.LicenseTab =
qryChartDueDate.Tab
WHERE (((DateDiff("d",[duedateChart],[DateChart]))>0))
GROUP BY qryChartDueDate.Vessel, qryChartDueDate.Tab,
qryChartDueDate.DiveDate, qryChartDueDate.DateChart,
qryChartDueDate.DueDateChart, DateDiff("d",[duedateChart],[DateChart]);
I don't use a report to output the query. I just copy the datasheet view
into Excel and do some calculations.
SORRY for such a long and confusing message. But i'm so frustrated i can't
summarize my thoughts.
Thank you.
My table has a Date field called "DiveDate" where we store the date a dive
was done and a Date field called "DateChart" where we store the date the
chart pertaining to that dive was received. I need to track that all charts
are received within 28 days following the end of the month the dive took
place.
I use 2 query
In the first query, I have a function that allows me to figure out the last
day of the month for that date and i add 28 days so i know the date i should
have received the chart. It looks like this:
DueDateChart: DateAdd("d",28,(lastofMonth([HarvestDate])))
Everything works beautifully.
I use that query as an input to the second query that i need to know how
many days elapsed between the duedatechart and the day the dive took place.
The calculation I do looks like this:
WaitDays: DateDiff("d",[duedateChart],[DateChart])
It works beautifully. The waitDays show positive numbers if chart were sent
in the allowed time frame , and minus numbers when they were not. All i need
are the Minus number. But i can't get that part to work.
If is use a criteria of > 0 in the waitDays column, i get the message: "you
tried and execute a query that doesn't include the specified expression
datedif etc..
as part of an aggregate function".
So I try adding a WHERE clause and the error message now reads:
"DataMismatch in Criteria expression"
The SQL with the WHERE clause is:
if I add a where clause so now the SQL is
SELECT qryChartDueDate.Vessel, qryChartDueDate.Tab,
qryChartDueDate.DiveDate, qryChartDueDate.DateChart,
qryChartDueDate.DueDateChart, DateDiff("d",[duedateChart],[DateChart]) AS
WaitDays
FROM tblLicense INNER JOIN qryChartDueDate ON tblLicense.LicenseTab =
qryChartDueDate.Tab
WHERE (((DateDiff("d",[duedateChart],[DateChart]))>0))
GROUP BY qryChartDueDate.Vessel, qryChartDueDate.Tab,
qryChartDueDate.DiveDate, qryChartDueDate.DateChart,
qryChartDueDate.DueDateChart, DateDiff("d",[duedateChart],[DateChart]);
I don't use a report to output the query. I just copy the datasheet view
into Excel and do some calculations.
SORRY for such a long and confusing message. But i'm so frustrated i can't
summarize my thoughts.
Thank you.