View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
gti_jobert[_84_] gti_jobert[_84_] is offline
external usenet poster
 
Posts: 1
Default VBA ADO SQL Query Problem


Hello all,

Thankyou for your input! The problem is that when you perform an '=' or
BETWEEN operation the criteria has to be wrapped in ##.


Code:
--------------------

.Open "SELECT [Date], SUM([Batch Qty]) As [Batch] FROM [" & TableName & "] " & _
"WHERE [Date] BETWEEN #" & Format(sDate, dd / mm / yyyy) & "# AND #" & eDate & "# " & _
"GROUP BY [Date] ORDER BY [Date]", cn, , , adCmdText

--------------------


The above now works, again thanks all for input!


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=529937