The code below gives an error "No value given for one or more parameters" and stops at the line : rs.open qry, cn
However if the other qry which is currently commented out (SELECT * FROM CallData) is executed, then the code runs without any problem.
What modifications do I need to make for the code to run correctly with the GROUP BY Query?
Dim cn As Object
Dim rs As Object
Dim qry As String
Dim Insertws As Worksheet
Dim strConnectString As String
Set Insertws = ThisWorkbook.Sheets("temp")
Insertws.Cells.Clear
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\corpfiler09\26663700_N01\NewAstt\ASTT.MDB;Jet OLEDB:Database Password=test;"
'Connect Database; insert a new table
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
'qry = "SELECT * FROM CallData;"
qry = "SELECT Bank, Count(Bank) from CallData where TicketDate = Date GROUP BY Bank"
cn.Open strConnectString
rs.Open qry, cn
Date()
(as per Jens answer) - Nick.McDermaid