Everymancomputers
asked on
Calculate total value of a datagrid column vb6
Hi,
I'm trying to calculate the total number value of a column in a data grid and display that value in a text box using Visual Basic 6. but I'm not sure on how to achieve this ?
I'm trying to calculate the total number value of a column in a data grid and display that value in a text box using Visual Basic 6. but I'm not sure on how to achieve this ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<calculate the total number value>
Lets be clear...
Are you wanting to "Count" the values (Number or Text) or "Add" them (Number Only)
Does VB6 not allow Aggregate Functions?
txtYourTextBox=Dcount("You rField","Y ourTable")
...for a count
Or this for a sum:
txtYourTextBox=Dsum("YourF ield","You rTable")
JeffCoachman
Lets be clear...
Are you wanting to "Count" the values (Number or Text) or "Add" them (Number Only)
Does VB6 not allow Aggregate Functions?
txtYourTextBox=Dcount("You
...for a count
Or this for a sum:
txtYourTextBox=Dsum("YourF
JeffCoachman
vb6 does not include Dsum
but should use a dbCommand object.
http://msdn.microsoft.com/en-us/library/ms675023(v=VS.85).aspx
commandText = "SELECT SUM(myColumnName) FROM myDataTable"
Set recordset = connection.Execute (CommandText, RecordsAffected, Options)
but should use a dbCommand object.
http://msdn.microsoft.com/en-us/library/ms675023(v=VS.85).aspx
commandText = "SELECT SUM(myColumnName) FROM myDataTable"
Set recordset = connection.Execute (CommandText, RecordsAffected, Options)
robberbaron
Thanks
It's been a long time for me since last using VB6...
I just did not remember...
:-(
Jeff
Thanks
It's been a long time for me since last using VB6...
I just did not remember...
:-(
Jeff
(ive never used DataGrid as found bound controls too troublesome. the "approxCount" property raises concerns !)