View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wliong[_10_] wliong[_10_] is offline
external usenet poster
 
Posts: 1
Default 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