Using Access 2007, I have a form with a subform. The subform is seen in
datasheet view and I have used the built in total mechanism to show the
total count (computers) and sum total (purchase price). This works nicely.
But since the totals are in the subforms in tab pages, they are not always
visible. I would like to show these totals in a field in the main form.
And to make it a bit more complicated, I would like to add the purchase
price from one subform (computers) with another tabbed subform (accessories)
to show the total expenditure per location.
Thanks. I am finishing up, so will try not to bother y'all with further
questions for a while.
Steve,
Create an unbound calculated text control on the main form to display the values from
the subform/s.
Let's say the count of computers in the subform is called CountComputers.
You would refer to that field in the calcualted text control as...
= Forms!frmYourMain!frmYourSubform.Form!CountComputers
or
= frmYourSubform.Form!CountComputers
Addressing the computer prices and accessory prices the same way... (all on one line)
with another calculated text control
= frmYourSubform.Form!TotalAccPrice + frmYourSubform.Form!TotalAccPrice

Signature
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
> Using Access 2007, I have a form with a subform. The subform is seen in datasheet view
> and I have used the built in total mechanism to show the total count (computers) and sum
[quoted text clipped - 6 lines]
> Thanks. I am finishing up, so will try not to bother y'all with further questions for a
> while.
SteveC - 22 Jun 2006 19:43 GMT
Al,
Thanks for your help. I just don't know what I am doing. I can get Access
to total and add in a datasheet but it doesn't show up as a field. I can get
it to total by adding a field "TotalAccCost" and using Sum([Cost]) in the
footer of the subform. When I add thr textbox to the Form and use your
reference, I get syntax errors.
Here is what I entered
=frmLocations Subform.Form.Form!TotalAccCost
That didn't work; syntax errors.
I also tried
=Forms!fromLocations!frmLocations Subform.Form!TotalAccCost
I assume I need underlines or brackets or quotation marks somewhere. Thanks
> Steve,
> Create an unbound calculated text control on the main form to display
[quoted text clipped - 22 lines]
>> Thanks. I am finishing up, so will try not to bother y'all with further
>> questions for a while.
Al Camp - 23 Jun 2006 04:17 GMT
Steve,
Forms!frmLocations![frmLocations Subform].Form!TotalACCCost
... a good example as to why you shouldn't use spaces in object names.
You need the brackets when using an object name with spaces.

Signature
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
> Al,
>
[quoted text clipped - 37 lines]
>>> Thanks. I am finishing up, so will try not to bother y'all with further questions for
>>> a while.