Gustav Brock
Gustav at cactus.dk
Fri Mar 18 10:59:35 CST 2005
Hi Paul You need to pass an SQL string in strSQL. I doubt very much that this: strQueries(intQuery) & " '" & dtKPIStart & "', '" & dtKPIFinish & "'" will do that. /gustav >>> paul.hartland at fsmail.net 03/18 5:49 pm >>> To all, I have a query in an Access database which is used to produce KPI reports, the query is called qryKPI_SickDays_By_Region_By Month3 and expects a start and finish date. In my VB application I have a connection to the database inside a funtion called OpenDataConn and use the following code (dtKPIStart and dtKPIFinish are the start and end dates). strSQL = strQueries(intQuery) & " '" & dtKPIStart & "', '" & dtKPIFinish & "'" Set rsKPIData = OpenDataConn.Execute(strSQL) When I run the program I the following error message: Run-time error '-2147217900 Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT' or 'UPDATE Anyone any ideas what I am doing wrong ? Thanks for the help in advance. Paul Hartland