View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
ward376 ward376 is offline
external usenet poster
 
Posts: 360
Default Parameter Driven Query

MS Query is set up to use parameters easily - you can use square
brackets with a space in between in the interface (not the wizard, the
advanced interface) for the criteria values. When you run or refresh
the query Excel will display a dialog where you can choose to use a
range (cell)/ formula or value for the parameter and whether to always
use this range/formula/value for this parameter. I've used this
feature with input boxes/userforms extensively with success.

If you're editing the SQL statement directly, you can use a question
mark for the parameter value and Excel will behave as described. (The
ui is just writing SQL based on your input anyhow)

You may run into some trouble trying to record complex queries (using
the advanced interface) as you write them. (can't record) You can work
around this by writing the query then record refreshing it.

Cliff Edwards