| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

12-09-12, 16:31
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 4
|
|
|
Splittting a Sum in a report
|
|
I am working on a work order database for my employees. we have "regular" and "emergency" work orders. They have to enter either one or the other in a field. When i run a report, I am using a sum to add all the hours for all the work orders, but they are combined. I know I can add more than one sum field in the report footer, but I want to separate them so that if the work order type is "emergency" it will be a sum in one field, and another for the "regular" field. I know someone is much smarter than me at this because I chase turds and fix things, not this complicated db stuff. Help!
|
|

12-09-12, 18:12
|
|
Resident Curmudgeon
|
|
Join Date: Feb 2004
Location: In front of the computer
Posts: 13,593
|
|
I'd need a couple more pieces of information to help you answer your question: - What database are you using?
- What Reporting tool are you using?
- What is the table schema? The column names and data types are most important part for now.
- What do you envision your report looking like?
If you can answer these questions, I can probably help you!
-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
|
|

12-09-12, 19:04
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 4
|
|
Splitting a Sum in a report
|
|
Pat,
I am using Access 2007 with their reports. I don't plan on exporting it to any other report software.
The text box label is "Work Order Type", which is where you have 'emergency' or 'regular'.
The text box with the hours for one particular work order is called "Total Hours" This total does not know wether it was emergency or regular hours.
The text box I want to have the sum of emergency hours would be called "Total Emergency Hours" and then the same layout for regular hours in a seperate box.
I envision this with four boxes in play, 'work order type', 'total hours' (for each individal work order), 'total E hours', and 'total R hours', both of which sum the total number for all work orders in the report.
Does that make any sense??
Thanks!
|
|

12-09-12, 21:34
|
|
Resident Curmudgeon
|
|
Join Date: Feb 2004
Location: In front of the computer
Posts: 13,593
|
|
Access is pretty easy. - Create a query based on your table
- Create a computed column something like Iif("Emergency"=type, hours, 0)
- Create another one for non-emergency
- Rock and roll using the query to build your report!
-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
|
|

12-11-12, 17:08
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 4
|
|
I am going to try that tonight. I was hoping not to have to do that, but i figured it was coming. Thanks!
|
|

12-12-12, 10:13
|
|
World Class Flame Warrior
|
|
Join Date: Jun 2003
Location: Ohio
Posts: 12,337
|
|
In Access, he could also create conditional fields on his report, one for each WorkOrderType, and then sum those fields in his footer.
|
|

12-12-12, 10:54
|
|
Jaded Developer
|
|
Join Date: Nov 2004
Location: out on a limb
Posts: 10,521
|
|
another way of removing the fur from this particular feline could be
to create two hidden controls on the report
called say StdHours and EmHours
set the datasource for those controls to
=iif([MyTypeColumn= 'Emergency'],[HoursWorked],0) 'for EMHours
=iif([MyTypeColumn <> 'Emergency'],[HoursWorked],0) 'for StdHours
then sum thoise controls int he report / group footers
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
|
|

12-12-12, 12:13
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 4
|
|
Do you know where I would put those "hidden" controls within the report. Would I be writing code in the field I want to sum the hours for each type of work, Emer and Reg??
|
|

12-13-12, 14:26
|
|
World Class Flame Warrior
|
|
Join Date: Jun 2003
Location: Ohio
Posts: 12,337
|
|
You could put them anywhere in the detail section.
I'm going to move this thread to the Access subforum, where you may get more advice.
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|