|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with Calculations in Report
I have a db that tracks citrus orders. In the customer orders form the clerk enters a citrus type, box size (full or half), and a quantity. The unit price is looked up from the products table, which contains separate prices for full and half box sizes.
I‘ve created a report that shows the products, sizes, and quantities for a given date. The report (based on a query that sums the quantities) shows the products (grouped by product name), box size, and quantity like this (formatting aside): Product Box-size Quantity (in product name header) Navel full 4 (in detail section) Navel half 1 (in detail section) Product Box-size Quantity Grapefruit half 1 I want to multiply the half-box quantities by 0.5 and add them to the full-box quantities to get an overall total to show in the product name footer. In other words, the report would look like: Product Box-size Quantity Navel full 4 Navel half 1 Navel Total: 4.5 Product Box-size Quantity Grapefruit half 1 Grapefruit Total: 0.5 I just can’t pull it off. I’ve put a textbox in the detail section ([newquantity]) that multiplies the quantity by 0.5 if the size is half but I can’t sum the values. A calculated textbox in the footer (eg. =sum([newquantity]) prompts me for a parameter input because some products don’t have full or half quantities. I’ve also tried putting code in the detail_format section that looks at the quantity, assigns a value of quantity*0.5 (if half), and adding it to the full quantities but no go. Queries have been fruitless because I can’t figure out how to multiply half box quantities by 0.5 and put them in the same column with full box quantities to be summed. An updateable query would work if I could modify the quantity with recordset operations without touching the actual values but is there such an animal? One very frustrated Access user breathlessly hoping for a solution. |
|
#2
|
|||
|
|||
|
Solved! I used an Iif function in an expression in a query that allowed me to multiply half-box quantities and add them to full-box quantities to get a new field called total. This became the record source for the report and I used a calculated control (=sum([total]) to sum the quantities.
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Help with Calculations in Report |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|