using results of SQL SUM... as fieldName

dogdays

Active Member
Joined
Apr 28, 2008
Messages
434
Office Version
  1. 2007
win 732 access 2003
I have executed an SQL statement:
Code:
SELECT nHouseholdNumber, nIndividualNumber, SUM (cAmount) as 'cTotalAmount'  FROM tblFiscalGifts WHERE nIdentity > 0  AND (dtDateEntered >= #7/3/2011# AND dtDateEntered <= #10/03/2011#) GROUP BY nHouseholdNumber, nIndividualNumber

I tried using the following to get the SUM variable cTotalAmount using
Code:
    cTotAmount = fiscalGiftsRecSet.Fields("cTotalAmount")

I get an error message stating this item is not in the collection How do I retrieve the results of the SQL statement?

tia Jack
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I dropped the single quotes around cTotalAmount and all is fine.

Jack
 
Upvote 0
Have you moved to a record in the recordset or are you moving through it's records?
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top