lothos12345 Posted November 12, 2003 Posted November 12, 2003 I have written a VB.NET program that interfaces with a Microsoft Access database. Now my problem lies when I try to execute an SQL statement using a date/time field in the where clause of the SQL statement. It keeps giving me the error of invalid SQL statement. Below is a copy of the SQL statement I am using any help would be greatly appreciated. Dim datefirst As Date Dim datelast As Date Dim StrWhere As String Dim appAccess As New Access.Application() datefirst = CDate(flddate.Text) datelast = CDate(flddatelast.Text) StrWhere = "SELECT * FROM Daily WHERE Daily.date >= #datefirst# AND Daily.date <= #datelast#" Quote
Moderators Robby Posted November 12, 2003 Moderators Posted November 12, 2003 try this... StrWhere = "SELECT * FROM Daily WHERE Daily.date >= #" & datefirst & "# AND Daily.date <= #" & datelast & "#" Quote Visit...Bassic Software
lothos12345 Posted November 12, 2003 Author Posted November 12, 2003 Thank You Thank you very much that did the it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.