I do not have the answer for you, my
MS Access is a little rusty and Dates in there were not my strong point.
Examples of using dates as criteria in Access queries - Access[
^]
However; I am obligated to point out that you are using code that is susceptible to SQL Injection. You should NEVER piece together an SQL statement from combining strings together.
The proper way to add the variables into this would be to use placeholders within your query and then add
Parameters
to the OLE Command. OLE restricts the placeholders to the question mark (
?), and the values that are added need to be in the exact order to fill in the prepared statement.
This is roughly what your query should look like
connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\resources\BDD_Suivi_vente.accdb;Persist Security Info=False";
sql = "Select * from Tble_MES_bds_121 WHERE (Statut LIKE ? + '%') AND (Email LIKE ? + '%') AND (Date_MES IS NULL) AND (DATEadd(dd, -7, CONVERT(Date_fin_MSTPE)) Like ? '%')";
OleDbCommand cmd = new OleDbCommand(sql, connection);
cmd.Parameters.AddWithValue("@Statut", RechMstpe18);
cmd.Parameters.AddWithValue("@Email", RechEmail19);
cmd.Parameters.AddWithValue("@MSTPE", date1);