View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default sql that will refer to a cell in excel

Assuming this in VBA:
Dim SQLString as string
SQLString="SELECT * FROM YourTable WHERE IssueDate <= #" & Range("B2").Value
& "# AND IssueDate = #" & Range("B3").Value & "#"

The exact syntax will depend on the database provider/engine etc you are
using, but something like that.

NickHK

"zero6060" wrote in message
...
How can I write a sql statement that will refer to a cell in excel.
I would like to do a date range like =<"B2" and ="B3"
and a parameter =<"C2" and ="C3"

You get my point...

I didn't want to write the statement in excel, because excel is slow

pulling
data from a huge data base (up to a minute) using several tables, where if

I
write the sql directly to the data base it returns data in just a few
seconds. But then I can't use excels convenient parameters