Query Help...PLEASE!!!

J

Jeff G

Well here I go again. Biting off more than my brain can handle. I have a
report that shows all of our machines in our plant. I’m tracking both machine
down time (the time the machine is broken) and Plant Down Time (the time the
machine is broken that hampers production) I have a form that we use to
gather all pertinent information such as the date, time notified of
malfunction, the problem , what we did to fix it etc…

I have a query that well, queries the data so I can view what is happening
each month. That part works great. Now to the meat and potatoes… I calculate
down times by using:
Minutes: DateDiff("n", [Time Notified], [Time Returned to Service])
In my query (Time Notified is when the machine goes down and Time Returned
to Service is when it’s working again), this works fine. In my report I
simply use =Sum([Minutes]) in a control box to get the total machine down
time (since Minutes is now added to my query).

A little back tracking now; on my form (the one that fills out the data in
my table) the technician uses a check box to signify if the machine down time
also results in “Plant Down Time†(the check box is a yes/no type).

Now in my query everything for that month shows up. Let’s say I have 40
entries that result in 1,000 minutes of down time. But, 5 of those entries
resulted in Plant Down Time for a total of 100 minutes (5 check boxes are
checked in the table of the query).

How do I get those 5 Plant Down Time entries to show a Sum of 100 minutes in
my report based on the check boxes being checked (yes)?

The report should show something like this:
(this is in the report header section)

Total Machine Down Time for the Month: 1000

Total Plant Down Time for the Month: 100

But I don’t know how to make the query only sum the result of the 5 Plant
Down Time check boxes.

I can make another query to just show the 5 check boxes and there minute
results but I do not know how to make that query usable on my form that is
already based on the first query.

Any help would be greatly appreciated.
 
T

Tom van Stiphout

On Fri, 16 Nov 2007 05:13:01 -0800, Jeff G

There are a few ways. Perhaps the simplest is to take advantage of the
fact that a YesNo field has 0 for No and -1 for Yes.
So the expression "-MyYesNoField*Minutes" would give you the minutes
of PlantDownTime.

Another way may be "Running Sums" in the report.

-Tom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top