Hi
I have a small problem with the SQL statement that returns the information from an Access 2003 table based on the dates input by the user. IT works fine if I manually code the dates as below:
but if I try to put ther variables in the statement like:Code:Dim da As New OleDb.OleDbDataAdapter("Select * From Sanctions Where [Date] BETWEEN #01/04/2009# AND #30/04/2009# AND [Group] Like '%EN%' AND [Description] <> 'Merits' ", cnDept)
it returns a syntax error.Code:Dim da As New OleDb.OleDbDataAdapter("Select * From Sanctions Where [Group] Like '%EN%' AND [Date] BETWEEN # SDate # AND # FDate # AND [Description] <> 'Merits' ", cnDept)
Can anyone help me with the syntax of this statement please? I am sure I have used variables in this way before for dates.
Thanks in advance![]()




Reply With Quote