dhborchardt
MIS
I have a query that will look at the PM table and see when the last PM was done, compare it with the PM recurance number, and if it is greater than the PM occurance number, the datediff will be set to yes and will then appear in the result.
This is what I would like to do.
If DateDiff is set to yes because it meets the criteria explained above, I then need the
tblPM.PMLastscheduled set to todays date so the next time the query is run I don't get the same results until the recurance number has been reached again.
I call this query from an ASP page and it will take these results and put them in another table for current PMs that need to be completed. I have found that I can't use user defined functions because I will get errors in the ASP page, so it needs to be done as an expression in the query itself.
I included the SQL from the query.
SELECT tblPM.PMID, tblPM.MEIDKey, tblPM.PMDesc, tblPM.PMRecur, tblPM.PMLastCompleted, tblPM.PMLastScheduled, IIf(DateDiff('d',PMLastCompleted,Now())>PMRecur,'Yes','No') AS IsDue
FROM tblPM
WHERE (((IIf(DateDiff('d',[PMLastCompleted],Now())>[PMRecur],'Yes','No'))="Yes"));
This is what I would like to do.
If DateDiff is set to yes because it meets the criteria explained above, I then need the
tblPM.PMLastscheduled set to todays date so the next time the query is run I don't get the same results until the recurance number has been reached again.
I call this query from an ASP page and it will take these results and put them in another table for current PMs that need to be completed. I have found that I can't use user defined functions because I will get errors in the ASP page, so it needs to be done as an expression in the query itself.
I included the SQL from the query.
SELECT tblPM.PMID, tblPM.MEIDKey, tblPM.PMDesc, tblPM.PMRecur, tblPM.PMLastCompleted, tblPM.PMLastScheduled, IIf(DateDiff('d',PMLastCompleted,Now())>PMRecur,'Yes','No') AS IsDue
FROM tblPM
WHERE (((IIf(DateDiff('d',[PMLastCompleted],Now())>[PMRecur],'Yes','No'))="Yes"));