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

Return Count/Sum from a Scalar Query

Status
Not open for further replies.

ProjectExplorer

Programmer
Mar 22, 2002
95
GB
I need to return the Count and Sum of a query in VBA.

i.e.

Dim Db as DAO.Database
Dim rst as DAO.Recordset
Dim SQL as string
Dim Total as Integer

SQL = "SELECT SUM (etc. Etc)" ....with paramters taken from a form text boxes.

Set Db = CurrentDb
Set rst as Db.OpenRecordset(SQL, DbOpenDynaset)

How do I run this query and just return the SUM (i.e. a so called scalar query that just returns the SUM value)so I can apply it to the Total variable.

Total = ?????????

Any help much appreciated.

Thanks
 
often easier to consider dsum and dcount functions mate...

JB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top