sql syntax- Help!

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]#;"
 
K

Ken Snell [MVP]

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] & "#;"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top