Query Question

Evenflow

Registered User.
Local time
Yesterday, 20:39
Joined
Apr 13, 2005
Messages
22
I'm making a query that has the fields Actual Hours, Estimated hours, and other fields related to those two. The Actual hours field contains how many hours someone has worked on a project, the Estimated is how long it should take. What I want to do from this query is trigger a report when someone has already used 80% of their estimated hours. For instance Bob is in hour 8 of his 10 hour job. I need to report to show this. I've tried various math in the two fields and generated a report but it isn't working. Any suggestions on this?
 
Add a calculated field to your query

Margin: ([EstimatedHours]*0.8)-[ActualHours]

Then add a criterion to this field of >0

This will return any record where actual hours is greater than 80% of estimated hours.
 
OK, tech check time. An Access query will not ever trigger anything. PERIOD. (Why? 'cause no code is associated with a query. There is no place to trigger FROM, much less trigger TO.)

You can run code that CONSULTS a query to check for qualifying criteria. But the question is, where and how?

Forms, reports, and macros have the ability to run code that can make decisions. Forms and reports each have class modules that can hold code. Macros can run code from general modules. Once code is running, there are ways to detect that a report is required.

Next problem... Unless the form, report, or macro is activated automatically, nothing will happen anyway. Because in MOST cases (not all), those things don't run themselves. The two exceptions are that a startup form (see the Help files) can trigger code to check for your conditions. A macro can be triggered by appropriate command-line options run from the Windows Task Scheduler. I think you want the /X macro-name option. Look up in the Help files to find "command line" functions.\

To be honest, I would not recommend either one anyway. I think you want to control when this report gets triggered. Otherwise, you'll get a glut of report output at inopportune moments.

This is not intended as a chastisement, but it sounds like you have read too much and then confused Access with a more robust, feature-rich database system like ORACLE; one that supports triggers based on data criteria. Access won't do that. It is a SMALL BUSINESS solution, geared towards low-cost, simple-minded ways of getting things done. Trust me on this, there is nothing simple-minded about built-in trigger events.
 
Thanks Neileg. That worked for the most part. A little more modification and I should be on the right road.

Doc Man, I think you read a little much into my question, or most likely I wasn't as clear as I should have been. I know Access queries wont trigger anything physical on its own. I just used the word trigger to illustrate I needed my query criteria posted to my report. Thank you though.
 

Users who are viewing this thread

Back
Top Bottom