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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Rows

Status
Not open for further replies.

ITheadache

IS-IT--Management
Jun 13, 2006
45
US
Is there a way to add all the rows in column without needed to use a loop that goes through each record individually?
 
Hi!

Since you asked this question in the Forms forum I would recommend setting the control source of a text box to

=DSum("YourField", "YourTable")

If you need code to do this you can use a query:

Dim rst = DAO.Recordset
Dim strSQL = String

strSQL = "Select Sum(YourField) As Total From YourTable"

Set rst = CurrentDb.OpenRecordset(strSQL)

then you can access the total using rst.Total

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top