Is there a way I can merge this two queries?


strSQL = "SELECT * FROM TABLENAME WHERE DATEFIELD BETWEEN #" & dtpFrom.Value & "# AND #" & dtpTo.Value & "#"


strSQL = "SELECT * FROM TABLENAME WHERE ANYFIELD LIKE 'ANYKEYWORD%' ORDER BY ID"


The first query is for date range. The next query is a normal query for keywords. I want to use the second query BUT will only search between the date ranges of the first query.

If only I could merge the two. Is this possible? Something like this.

strSQL = "SELECT * FROM TABLENAME WHERE ANYFIELD LIKE 'ANYKEYWORD%' AND WHERE DATEFIELD BETWEEN '" & dtpFrom.Value & "' AND '" & dtpTo.Value & "'" ORDER BY ID"

By the way, I am using SQL Server. Thanks for the help.