Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filter by cell value when importing external data via ms query

Status
Not open for further replies.

leanne123

Technical User
Jun 6, 2008
18
US
I have an ODBC connection to an sql database. I have created a DSN file and want to filter the data I bring back by an invoice number. However instead of typing this invoice number into MS query filter feature, I want MS query to find it in a cell on one of the tabs in the file. Is this possible?
 




If you are using MS Query (Data > Import External Data...), you can make a Parameter Query using a value in a cell on the sheet containing the QueryTable.

Alternatively, it can be done with simple code. Post in Forum707, if you need to pursue this option.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
How do I make a parameter query using the 'query wizard' filter data? What is the syntax for point to a cell in Excel?
 



Data > Import External Data > Parameters.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
my parameters option is greyed out, any idea why? I tried to access it from the original queried data tab and a new empty tab?
 




You must first EDIT your query, substituting the Criteria VALUE for something like this...
[Enter Value]

The Query Manager will interpret this as a parameter, and when you File > Return Data to Excel, you will be prompted for a value.

Now the Parameters option will be available. Select the THIRD option in the dialog, specifying the appropriate CELL reference, AND check the REFRESH on change box.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top