Adjusting Microsoft Query Filters

ArtofExcel

New Member
Joined
Jul 5, 2016
Messages
17
Hey everyone,

I'm attempting to make copies of a document I'm already using but each copy will pull different rows out of a master "source" document. For example the document I already have uses Microsoft Query pulls rows with strings like "04 TestA", "05 TestB", "06 TestC" in one column and strings like "ABC" or "BCD" in another column. This returns all rows with any combinations of those strings in those two columns. The command text for it is as follows:

WHERE (`'Source Table$'`.Column_Name1='04 TestA') AND (`'Source Table$'`.Column2='ABC') OR (`'Source Table$'`.Column_Name1='05 TestB') AND (`'Source Table$'`.Column2='ABC') OR (`'Source Table$'`.Column_Name1='06 TestC') AND (`'Source Table$'`.Column2='ABC') OR (`'Source Table$'`.Column_Name1='04 TestA') AND (`'Source Table$'`.Column2='BCD') OR (`'Source Table$'`.Column_Name1='05 TestB') AND (`'Source Table$'`.Column2='BCD') OR (`'Source Table$'`.Column_Name1='06 TestC') AND (`'Source Table$'`.Column2='BCD')

Now for the new documents I want to change which rows are pulled to those that have "01 TestX" in Column_Name1 with the same strings as before in Column2. I do not want to rebuild the queries from scratch as the document is complex and the the queries pull into tables that resize based on how many rows are found and includes extra columns with other information pulled from other parts of the file as well. Rebuilding each table would be very time intensive and involve fixing a lot of named references, ect.

I've tried changing the command text directly to what I want but I then get a ODBC error saying the query has "to few parameters". Is there anyway to make these changes without rebuilding the query from scratch? (I have only ever used the wizard to set up new connections), when I attempt to use the "Edit Query..." button I get an error saying "This query cannot be edited by the Query Wizard". I also have 2 other tables in the same file that are fed data via Queries from the original Query to the source file (the source file holds a lot of data so I only referenced it once in the file and built the rest of the document from that one reference, my hope is these other tables will automatically adjust if I can rebuild the one reference query without demolishing it).

I'm sure this sounds confusing so please ask for any clarifications needed.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,215,857
Messages
6,127,374
Members
449,382
Latest member
DonnaRisso

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top