Notes from Daily Encounters with Technology RSS 2.0
 
# Wednesday, April 28, 2010

Query parameters are a very useful Excel feature allowing parameterization of database queries used to import data in Excel. They are really simple to use as well. On the Definition tab of the Connection Properties dialog there is a Parameters… button at the bottom. It gets enabled as soon as there is a parameter defined in the Command text – you define it by typing in a question mark (?) instead of a value in the WHERE clause of the query, as seen in the image below.

 Connection Propertie dialog

Unfortunately there is a limitation for using this functionality which turns out pretty unintuitive in Excel 2007. It is only supported for Microsoft Query based queries. For all other types of queries available in Excel you get the error “No value given for one or more parameters.” when you add a parameter to the Command text. Since the error doesn’t even hint at the real cause of the problem it took me some time before I figured it out. The thing to remember is: If you want to use query parameters, you must select Microsoft Query as the external data source when importing the data for the first time. This can’t be changed at a later time.

Get External Data From Microsof Query

Wednesday, April 28, 2010 8:01:23 PM (Central European Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Software | Office
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Sponsored Ads

About Me

Damir Arh

Microsoft Certified Professional

View Damir Arh's profile on LinkedIn

Profile for ExAmigan

ExAmigan

Twitter
VS File Explorer looks interesting. I have to give it a try. http://digs.by/9Awmbv 5 hours ago
Potepanja v naravi: Pokljuška soteska http://goo.gl/fb/LeHx9 1 day ago
Is hosting a preview handler in your own app still an unsupported scenario? http://digs.by/cdY3Ul 1 day ago
RT @MladenPrajdic: RT @danmartell: Top Five Regrets of the Dying http://bit.ly/b8Qywr #MustRead #Friends 2 days ago
On my way to Celje today I've seen parhelion (sundog) for the first time http://imgur.com/NssST http://digs.by/dm1TUQ 6 days ago
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

All Content © 2010, Damir Arh, M. Sc. Send mail to the author(s) - Privacy Policy - Sign In
Based on DasBlog theme 'Business' created by Christoph De Baene (delarou)