sql syntax- Help!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In the following sql statement, start_date_cal.Value and end_date_cal.Value
are coming from calendar objects. The values are ok and displayed in text
boxes. When I try to use them in the sql statement, I get a syntax error. Am
I using the # symbols correctly? Do I need them, or should I be doing this a
different way? DATE is coming from a table. Do I need to specify the entire
path for DATE? Thanks.

strSQL = "select * " _
& "where DATE Between " _
& "#[start_date_cal.value]# And #[end_date_cal.value]#;"
 
You need to concatenate the values of the controls into the string:

strSQL = "select * " _
& "where DATE Between " _
& "#" & [start_date_cal.value] & "# And #" & [end_date_cal.value] & "#;"
 
Back
Top