Syntax for ADO Query String

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi,

I am trying to use ADO with an Excel spreadsheet. I have
done this successfully before, but I am having problems, I
think, because one of the fields I am using has a space in
it. (End Date). The string I am using is:

strquery = "Select * from [Sheet1$] where Property='" &
LookupP & "' and [End Date]='" & LookupEnd & "'"

Would anyone be able to tell me what I am doing wrong? I
have also tried several different ways.

THANKS!
 
John said:
I am trying to use ADO with an Excel spreadsheet. I have
done this successfully before, but I am having problems, I
think, because one of the fields I am using has a space in
it. (End Date). The string I am using is:

strquery = "Select * from [Sheet1$] where Property='" &
LookupP & "' and [End Date]='" & LookupEnd & "'"

What 'problems' e.g. an error message? I don't think the column name is
the problem because you've put it in brackets. Perhaps it is the value
of the LookupEnd variable e.g. is it a valid date format? Try
[End Date]='" & Format$(LookupEnd, "yyyy-mm-dd") & "';"

Jamie.

--
 

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

Back
Top