Variable value from query

  • Thread starter Thread starter Neal Ostrander
  • Start date Start date
N

Neal Ostrander

I have a query that takes the sum of one comlum and subtracts the sum of
another column to get the balance. Is there a way to run this query in vba
and assign the returned value to a variable.

Thanks
Neal
 
I have a query that takes the sum of one comlum and subtracts the sum of
another column to get the balance. Is there a way to run this query in vba
and assign the returned value to a variable.

Thanks
Neal

dim curReturnValue as currency
dim qdf as dao.querydef
dim rs as dao.recordset
set qdf=Dbengine(0)(0).Querydefs("QueryName")
set rs=qdf.openrecordset

curReturnValue=rs.fields("Total")

you mean something like that?
 
Is the coding the same using ADO?


dim curReturnValue as currency
dim qdf as dao.querydef
dim rs as dao.recordset
set qdf=Dbengine(0)(0).Querydefs("QueryName")
set rs=qdf.openrecordset

curReturnValue=rs.fields("Total")

you mean something like that?
 
Back
Top