dbTalk Databases Forums  

totals

comp.database.ms-access comp.database.ms-access


Discuss totals in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
 
Posts: n/a

Default totals - 06-12-2004 , 04:39 AM






Does anyone know how, using asp and an access database, one could display the total of the records retrieved. all of the records
retrieved are #'s and I need to display the sum of all those #'s.
thanks in advance!



Reply With Quote
  #2  
Old   
Andrew Backer
 
Posts: n/a

Default Re: totals - 06-14-2004 , 01:40 PM






I assume you are connecting to access and showing everything you need to
already. The totals are pretty easy to do. If you are displaying all
the records, just sum up the items as you go along. It might be more
helpful if you could describe your situation better, but here goes...

If you want to just display the totals, "select count(*) from table
where ..." to get the total in a recordset. Then take the First value
in the first row ( recordset.Fields(0).Value ) to get the count that was
returned.

Here is a simple function that duplicates (mostly?) VB's Dlookup
function. It assumes a global connection called 'oConn' though.

Function DLookUp(sExpr , sDomain, sWhere)
dim oResult
on error resume next
oResult = oConn.execute("select " & sExpr & " from " & sDomain & "
where " & sWhere).Fields(0).Value
if IsNull( oResult ) then oResult = ""
DLookUp = oResult
End Function

jjrmy1 (AT) earthlink (DOT) net wrote:
Quote:
Does anyone know how, using asp and an access database, one could display the total of the records retrieved. all of the records
retrieved are #'s and I need to display the sum of all those #'s.
thanks in advance!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.