Refrencing Totals Row in datasheet

C

chasday

I have a form that includes a subform (Subform1). I've used the Totals
feature to add a totals row to the subform datasheet. Is there a way to
reference the total for a “cost†column so that I can use it for other
calculations on the form? It seems like this would be simplier than writing
new queries.
 
A

Allen Browne

Presumably this is the new datasheet totals available in Access 2007. I
don't think you can get at them programmatically, so use the same approach
we used in previous versions:

1. Open your subform in design view.

2. On the Arrange tab of the ribbon, click the Form Header/Footer icon on
the Show/Hide chunk (right hand end.) Access shows new sections for the form
header and form footer.

3. Add a text box to the Form Footer section, and give it these properties:
Control Source =Sum([Cost])
Name txtSumCost
Format Currency
replacing Cost with your field name.

4. You can now refer to the value of your txtSumCost text box in your code.

The form footer won't show in Datasheet view, or you can set its Visible
property to hide it in Continuous view.
 

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

Top