Displaying sum of totals in datasheet view on form (1 Viewer)

Carpetwarehouse

Registered User.
Local time
Today, 06:44
Joined
Jun 11, 2012
Messages
25
Ok I have a form which is a summary of details about jobs, on this form is a sub form which is based on a query which displays in datasheet view. The query calculates the area by multiplying the length and the width fields and multiply the area by the unit cost giving a line total.

What i want is to see a running total at the bottom of all the line totals from that job and cant for the life of me get it to work.

If i open the query directly i can display the total at the bottom but when the query is view via the form the totals button on the tool bar is grayed out?

This is probably a simple solution.

Thanks :)
 

MStef

Registered User.
Local time
Today, 06:44
Joined
Oct 28, 2004
Messages
2,251
Send a short example of your MDB, (access2000 or 2002-2003).
 

Carpetwarehouse

Registered User.
Local time
Today, 06:44
Joined
Jun 11, 2012
Messages
25
Sorry what do you mean by short example? do you want me to email you the database?
 

MStef

Registered User.
Local time
Today, 06:44
Joined
Oct 28, 2004
Messages
2,251
Yes, short example of your application, with fictitious data.
 

Sketchin

Registered User.
Local time
Yesterday, 22:44
Joined
Dec 20, 2011
Messages
575
In the subform footer, place a textbox with this:=Sum([Field1]*[Field2]) (Or whatever your calculation is)

In the Detail section of your main form put something like this:
=[Subfrmname].Form!txtboxname

This is what I did for an invoice form. The last part displays the grand total on the main form. Not sure why you have to calculate on the sub form and display on the main form, but c'est la vie!
 

Ashtechsmith

Registered User.
Local time
Yesterday, 22:44
Joined
May 12, 2012
Messages
13
If you need to sum a column of data or use another aggregate function quickly, you can add a Totals row to a table, query result set, or a split form — a form that contains a datasheet. Totals rows save a lot of time, because you do not have to add a function to a query or write VBA code.

Remember these rules as you proceed:

The functions provided by the Totals row vary with the data type setting for the column of data. For example, Access provides only the Count function for fields set to the Text data type because you cannot perform mathematical operations on text data.
The first field in a Totals row contains the word Total until you change it by selecting a function.
You cannot add a Totals row to a report. You can use aggregate functions in reports, but you need to use other techniques. For more information about aggregate functions and expressions in reports, see the article Create a grouped or summary report.
You can add a Totals row to tables and queries open in Datasheet view. You can also add a Totals row to a split form open in Form views.
By default, Access excludes Totals rows from filter and sort operations.

The following sections explain how to use a Totals row in a datasheet and a split form.
Add a Totals row

Open a table or query in Datasheet view, or open a split form in Form view. To do so, in the Navigation Pane, right-click the table, query, or form and click Design View or Form View on the shortcut menu.
On the Home tab, in the Records group, click Totals.

Access Ribbon Image

A new Total row appears below the star row in your datasheet or split form.

A new, blank Totals row

Note If you are working in a split form that was created in an earlier version of Access and then converted to the new .accdb format, you do not see a star row in the datasheet. That difference does not affect a Totals row in any way.

In the Total row, click the field that you want to sum, and then select SUM from the list.

Selecting the SUM function for a Totals row

For information about the function, see the section Understand the aggregate functions, earlier in this article.
Remove a Totals row

On the Home tab, in the Records group, click Totals.

Access Ribbon Image

Note You cannot cut or delete a Totals row, you can only turn it on or off. However, you can copy a Totals row and paste it into another file, such as a Microsoft Office Excel 2007 workbook or a Microsoft Office Word 2007 document. The next set of steps explains how to copy a Totals row.
Copy a Totals row to another file

Click the row selector — the box at the right or left end of the Total row — to highlight the entire row.

On the Home tab, in the Clipboard group, click Copy.

Access Ribbon Image

–or–

Press CTRL+C.

Open the target file into which you want to paste your data.
Select the last row of your destination table, query result set, or form.
On the Home tab, in the Clipboard group, click Paste.

Access Ribbon Image

Top of Page Top of Page
Count the number of values in a column

You use the Count function when you need to count the number of items in a column. The Count function runs only against a single column of data and returns a single value. The function works with all data types.
Count items in a column

Open a table, query result set, or form. You can use any view except Design view.
On the Home tab, in the Records group, click Totals.

Access Ribbon Image

A new Totals row appears below the star row in your datasheet.

In the Total row, click the field that you want to count and select COUNT from the list. For information about the function, see the section Understand Sum and the other aggregate functions, earlier in this article.

Note Access does not calculate the value for the function until you commit your changes. To do so, you can enter a new value in another field, or press F9 to requery the data.
 

Carpetwarehouse

Registered User.
Local time
Today, 06:44
Joined
Jun 11, 2012
Messages
25
In the subform footer, place a textbox with this:=Sum([Field1]*[Field2]) (Or whatever your calculation is)

In the Detail section of your main form put something like this:
=[Subfrmname].Form!txtboxname

This is what I did for an invoice form. The last part displays the grand total on the main form. Not sure why you have to calculate on the sub form and display on the main form, but c'est la vie!

Is there a way of adding a footer in datasheet view? as thats how the data is displayed.

I dont want to display on the main form, i want to calculate and display on the subform, but because its a datasheet there isnt any space to put fields like in a form and i cant get the totals line at the bottom of the datasheet to display.
 

Sketchin

Registered User.
Local time
Yesterday, 22:44
Joined
Dec 20, 2011
Messages
575
Do you want a total at the end of each line that is for each unique item? Or a grand running total for everything at the bottom?

If its for everything, you just use a sum expression in a query, then reference that expression in a textbox on the detail section of the datasheet
 

grenee

Registered User.
Local time
Yesterday, 22:44
Joined
Mar 5, 2012
Messages
212
Hi there.

This explanation works fine; but I want to add a text into the cell rather than sum or some other calculation. How can this be done? Actually I want to put the work "Total" in the cell
 

Users who are viewing this thread

Top Bottom