Click to See Complete Forum and Search --> : Ledger
chem1
September 14th, 1999, 02:42 PM
I am developing a datebase Program in VB6.0 for which I have placed a Text Box on a certain form.This text box is to contain the sum of all the values in a certain column of DBGrid control.
I simply cannot comeup with a code to tell the program to go through the column.
Urgent help is neede as my project is stuck
Thankx in advace...
Lothar Haensler
September 15th, 1999, 01:30 AM
yesterday, Chris Eastwood posted code for iterating over all rows of a dbgrid using the TextArray property of the grid control.
Use that to calculate the sum of a certain column.
Crazy D @ Work
September 15th, 1999, 03:16 AM
Or use a SUM SQL query if possible (which is probably faster then looping through the control to get the values)
Crazy D @ Work :-)
chem1
September 15th, 1999, 01:24 PM
I have tried using the SUM in SQL:
Select [Sum(ColumnName)] as [DummyName] from [DatabaseTable]
It works fine in Data Manager but when I use the following code
Dim Sql as string
Sql= Above Statement
Adodc1.recordsource=sql
adodc1.refresh
the following error occurs
"At least one Parameter is missing"
I would appreciate if any help is extended
Thankx in advance
September 15th, 1999, 03:36 PM
It works Fine. Check parentheses.
chem1
September 16th, 1999, 12:44 AM
Thanks for the hint.I have already checked paranthses but it still does not work.
What do u say about the fact that when the Recordsource Property of ADODc is set to cmd Table ,the ADODC control does not accept any SQL Commands ,even through VB Code.If I set it to cmdTExt then it does not allow me to move further unless I put an SQL Query in the text box.
Which query works: the one in the Property Page or the one in the Code
Thankx in advance...
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.