Question Locked

VB6 and sql server 2005 express, sum field to text box on form

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I was wondering if anyone had a solution for this im sure its something simple, but im having trouble with it.
first off i have a mod that does a sql connecting and it works fine, my problem is that i can't seem to get a sum amount between dates to send to a text box on a form. EG:
Call SQLOpen(1, "", "", "", "Provider=SQLOLEDB.1;Password=testing;Persist Security Info=True;User ID=sa;Initial Catalog=ftstjohn;Data Source=SQLSERVER\SQLEXPRESS")
sqlQuery = "SELECT sum(fldCash) as fldtCash From tblCash WHERE fldDate BETWEEN '01/01/2008' AND '01/31/2008'"
frmTumblerTotals.txtFields.item(1).Text = sqld.Fields.item.Value(fldtCash)
Call sqlCallQuery(1, sqlQuery, sqld)
if anyone could help it would be appreciated

Thanks in advance

4 replies

by moose4098

hi Tony and thanks for replying, but if i set the fields after the call query i get an error in the sqld.fields.item.value(fldtcash) on "item" Argument not optional

by tony hopkinson

sqld.fields.item.value(fldtcash)
given your query, I woud have expected it to be a string that contained "fldtcash" or that the call should simply be sqld.fields.item.value("fldtcash").

This discussion is closed to new replies.