Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating ADO recordset from totals query

Status
Not open for further replies.

EddyLLC

Technical User
Mar 15, 2005
304
US
I use the following code to open an ADO recordset of a totals query. I then try to take the total for field TotA and put it into a variable, intTot1. I receive an error message telling me the field (SumOfTotA)is not found in the collection. Am I referencing it incorrectly? or possibly totals queries can't be used as a ADO recordset? I know the value does exist in the query.

Thanks.

Set rsQry = New ADODB.Recordset
rsQry.Open SQLStmnt, CurrentProject.Connection, adOpenKeyset, adLockOptimistic

If Not rsQry.EOF Then
intTot1 = rsQry![SumOfTotA]
End If
 
What is SQLStmnt ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You nailed it. The variable you refer to is a bit of SQL that find a specific record in the recordset. It was referencing a different query. Too long staring a code today. Thanks so much for the insight.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top