Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculated Control with extras 1

Status
Not open for further replies.

LISABBB

Technical User
May 3, 2006
11
0
0
US
I have a subform, which lists data based on the invoice number of the main form. So far, it works great. I then try to get the totals for PRICE of the items on the subform. Again, it works! Now it gets tricky...there are several categories which the various items fall into, like LABOR, PARTS, SHIPPPING. I am trying to get subtotals for each of the categories that appear on the form. I want separate controls for each subtotal, and ultimately the subtotals need to appear on the main form, but I can deal with that after I figure out how to get them on the subform. I know I want a calculated control that is not part of my table, and need to put something into the CONTROL SOURCE properties field. I must be close...If I use DSUM, I can add a qualifier to the equation that specifies the category. Good news, it gives me the totals for each category, but bad news, it includes everything in the table, not just the items associated with the invoice of interest. If I use SUM, it won't let me use the qualifier that limits the number to a specific category, so I get a total for the entire form, not just the individual category.

PLEASE PLEASE help.
 
How about:
Sum(IIf([Field1]=1,[Field2],0))
 
Thanks. I still end up with totals for items within that category that are in the entire table. I need to block out the items that are not on that invoice. I would have thought this would happen simply becuase it is a subform and is linked only to that invoice, but apparently the functions don't pay any attention to the form, just the table. Any other ideas?
 
Can you post the control source that you used, based on my suggestion, please?
 
A little more fussing around with it and I kind of figured out where my error was. You were absolutely right! Thank you so much!

In case you still want to see what I did, it was
=Sum(IIf([TXTYPE]='Labor',[PRICE]*[QUANTITY],0))

I am not exactly sure where I was off when I tried it before. One problem was using the calculated control [EXTENDED PRICE] instead of calculating the control. But the other problem, with the entire table being calculated, must have been the result of a type somewhere. I came back and tried again and voila!

Next, I'll be trying to do it on a report. I may be back for more wisdom! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top