Thread: Excel SQL query
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.querydao
Dick Kusleika Dick Kusleika is offline
external usenet poster
 
Posts: 179
Default Excel SQL query

facet wrote:
one more request , what needs to be entered to the cell in order to
select all items of the parameter e.g. all months from the
range....tried * but doesn't work


As far as I know, you can't. Here's a workaround:

Put two parameters even though you only need one; a greater than or equal to
and a less than or equal to. Like this:

SELECT CUSTOMER.Name, CUSTOMER.City
FROM CUSTOMER
WHERE (CUSTOMER.City=? And CUSTOMER.City<=?)

Now in Excel, point the first parameter to J1 and the second parameter to
K1. You can automatically refresh on J1 changing, but not K1. In K1, put

=IF(LEN(J1)=0,"zzzz",J1)

Where zzzz is the highest possible value for whatever datatype you're using.
In this example, if you put Omaha in J1, then Omaha will appear in K1 and it
will return all customers from that city. If you delete J1, then K1 will be
zzzz and it will show all customers.

A little kludgy, but that's the best I could do. I've crossposted this to
the querydao group in case someone over there knows a better way. I've set
the follow up back to programming, so any responses will show up here.

--
Dick Kusleika
MVP - Excel
Daily Dose of Excel
http://www.dicks-blog.com