|
-
Oct 17th, 1999, 09:04 AM
#1
Thread Starter
New Member
hi there,
i'm quite new to database programming in VB and im wondering whats the best way to total records. I have a database with like a hundred or so numeric fields, and i want to get a single record containg the totals of those fields. Right now i'm doing something like this: For X = 0 To 138
Set temp = dbs.OpenRecordset("select sum(" + mainrec.Fields(X).Name + ") as s from mdbtemp where year = '" + year + "'")
recs.Fields(X).Value = temp.Fields("s").Value
Next
which i believe is terrible and inefficient.
is there any easier way to do this like the "total" command in foxpro? thanks in advance.
-
Oct 17th, 1999, 11:25 AM
#2
New Member
why don,t you use the SUM Command of SQL.Also you can put the contents of an entire column in a loop and total them.Another way is to total the record in the Data Report rather than anywhere else because that is where it is needed.There u can use the sum function.
Hope this helps
Last edited by chem1; Sep 12th, 2019 at 01:42 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|