Problems with SQL Parameters in Excel

Hello,

I am quite new to SQL.

I have an SQL query that I am trying to run in Excel via MS query. I am trying to use between date parameters in the WHERE clause: I have a few conditions in the WHERE clause and the last is as follows
AND CAST(t.comp_date AS Date) BETWEEN '05/02/18' AND '05/08/18

I have tried to replace with
AND CAST(t.comp_date AS Date) BETWEEN ? AND ?

but I am getting the following errors
Microsoft ODBC SQL Server Driver Invalid Parameter Number
Microsoft ODBC SQL Server Driver Invalid Parameter Index

I want the dates to be input into the Excel spreadsheet. I have also tried putting the parameter into MS query but get MS Query: SQL Query can’t be represented graphically message.

Any ideas how I can get this work?

I can't find a solution on the internet and I do not know how to write stored procedures.

Many Thanks

Vinnie

You might try Excelforum