Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2004, 12:18 PM
Authorized User
 
Join Date: Jun 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default change status during query

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,'Y es','No') AS IsDue
FROM tblPM
WHERE (((IIf(DateDiff('d',[PMLastCompleted],Now())>[PMRecur],'Yes','No'))="Yes"));





Similar Threads
Thread Thread Starter Forum Replies Last Post
Vba to Change Pass Through Query Connection Coby Access VBA 1 April 25th, 2011 09:12 AM
Recipe to change CR query at run time. dbron Crystal Reports 4 June 24th, 2009 03:07 AM
query result page? CHANGE 1 cedwards Dreamweaver (all versions) 31 July 1st, 2005 12:05 PM
Need to change MS Access 2000 Query gilgalbiblewheel Classic ASP Databases 0 June 13th, 2005 11:10 PM
Change Status bar qazi_nomi HTML Code Clinic 1 July 10th, 2004 04:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.