|
-
May 18th, 2000, 02:08 AM
#1
Thread Starter
Hyperactive Member
Dear VB users,
In the next rows you can calculate via SQL the average & the sum.
But where can I find the result?
'Calculate the average
Set RS = DB.OpenRecordset("select avg(MyField) from MyTabel") '
RS.MoveLast
'RESULT ? ? ? ? ? ? ? ? ?
'Calculate the sum
Set RS = DB.OpenRecordset("select sum(MyField) from MyTabel ") '
RS.MoveLast
'RESULT ? ? ? ? ? ? ? ? ?
Thanks for your information.
Nice regards,
Michelle.
-
May 18th, 2000, 02:47 AM
#2
You can use
Set RS = DB.OpenRecordset("select avg(MyField) as Avgval from MyTabel") '
RS.MoveLast
msgbox rs!avgval
'or msgbox rs.fields(0).value
Set RS = DB.OpenRecordset("select sum(MyField) as Sumval from MyTabel ") '
RS.MoveLast
msgbox rs!Sumval
-
May 19th, 2000, 09:29 PM
#3
Thread Starter
Hyperactive Member
Hello sarun,
Thanks for your information.
Michelle.
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
|