Query Problem

G

Guest

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 etc…

I have a query that well, queries the data so I can view what is happening
each month. That 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.

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â€.

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?

The report should show something like this:

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.
 
R

rquintal

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 etc...

I have a query that well, queries the data so I can view what is happening
each month. That 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.

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".

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?

The report should show something like this:

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.

Add a second calculated sum in the query,
PlantMinutes: Sum(DateDiff("n", [Time Notified], [Time Returned to
Service])*IIF(checkbox = true,1,0)

Change the name checkbox to the name of the field in the table, you
didn't state clearly what its name is.

Q
 

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

Similar Threads


Top