ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I execute this query? (https://www.excelbanter.com/excel-programming/355354-how-can-i-execute-query.html)

wliong[_10_]

How can I execute this query?
 

Hi all,

I'm trying to do a query from MS Access to MS excel which have th
condition that the date period has to be on a specific month, and
want to get the sum of the value.
I try to do this, but it didn't work.


Code
-------------------
MyQuery = "SELECT SUM(JOBACTIV.POVALUE) as sum FROM JOBACTIV WHERE JOBACTIV.JOBCLASS = 'S';"
Set rs = db.OpenRecordset(MyQuery)
Cells(1, 1).Value = Su
-------------------


How can I fix this problem?
Note: JOBCLASS is a field in the Access table

Thank you very much

--
wlion
-----------------------------------------------------------------------
wliong's Profile: http://www.excelforum.com/member.php...fo&userid=2834
View this thread: http://www.excelforum.com/showthread.php?threadid=51986



All times are GMT +1. The time now is 02:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com