|
-
Oct 28th, 1999, 11:27 AM
#1
Thread Starter
New Member
Hello,
I have a simple database program in which I want to add all the entries in a specific COLUMN and then put the value in a text box.
I know that one way to do it is through SQL SUM command.I want to know whether there is a way to use Coulmns COllection in VB to achieve this,
Thankx in advance....
-
Oct 28th, 1999, 09:06 PM
#2
Guru
if you just want to display all of them, do this:
(this uses ADO)
dim cn as new connection
dim rs as recordset
dim I as long
cn.open <connectionstringhere>
set rs = cn.execute("Select <myfield> from <mytable> where <criteria>")
do until rs.eof = true
text1.text = text1.text & vbcrlf & rs.fields(0).value
loop
all done
HTH
Tom
-
Oct 29th, 1999, 10:55 AM
#3
Frenzied Member
Be much faster to do:
sSQL= "select sum(column) from table"
set rstemp= databaseobject.OpenRecordSet (sSQL)
if rsTemp.EOF = False then ' there's entries to process
form.text = rsTmp.Fields(0)
else
form.text = 0
end if
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
|