View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wliong[_11_] wliong[_11_] is offline
external usenet poster
 
Posts: 1
Default How can I modify the SELECT statement?


Hi,

I'm trying to query data from MS access 97. Is there any way that I can
add the WHERE condition such that the query is executed on a certain
input date. The Access table has the start date in it, and I want the
query to run on any time frame, for example (I want to get the sum of
POVALUE from February 1, 2006 until March 3, 2006). How can I do this
or what should I modify from the code below?

Thank you so much.



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


--
wliong
------------------------------------------------------------------------
wliong's Profile: http://www.excelforum.com/member.php...o&userid=28343
View this thread: http://www.excelforum.com/showthread...hreadid=519883