Solved

Microsoft Query Parameters.....simple!

Posted on 2004-04-28
11
676 Views
Last Modified: 2008-02-01
I am using Microsoft Query within Excel to source some reports feeding from an access table.

I wanted to put filters on the data and have setup a feed that picks the filter criteria from another sheet within the excel workbook which works fine.

My problem is:
What if I want to show all records in the query and apply no filter? Based on the current configuration if I leave the cells that determine the filters blank then the query returns nothing. I thought by using "*" that might pull everything but it doesn't seem to.

I'm sure it must be simple!!!

Any ideas?

0
Comment
Question by:JGWY
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 

Expert Comment

by:joebrez
ID: 10938830
Do you have field in the query that might make it a null query?
0
 

Author Comment

by:JGWY
ID: 10938855
No, unless the last row of the access table which is always blank for the next line of data is causing this?
0
 
LVL 17

Expert Comment

by:walterecook
ID: 10939047
How about posting the SQL.  Maybe you have an errant space in there or something.

Walt
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:JGWY
ID: 10939125
HEre ya go....

SELECT `emea1-3`.ORIG_COST_CTR, `emea1-3`.CHRG_COST_CTR, `emea1-3`.LVL1_GEO_NM, `emea1-3`.LVL2_GEO_NM, `emea1-3`.LVL3_GEO_NM, `emea1-3`.LVL2_LOB_NM, `emea1-3`.LVL3_LOB_NM, `emea1-3`.LVL4_LOB_NM, `emea1-3`.`TIER$_PROD_DS`, `emea1-3`.TIER0_PROD_DS, `emea1-3`.TIER1_PROD_DS, `emea1-3`.YEAR_NO, `emea1-3`.MO_NO, `emea1-3`.SumOfBILL_CHRG_VOL_CT, `emea1-3`.SumOfBILL_CHRG_AM, `emea1-3`.BILL_CHRG_TYPE_CD, `emea1-3`.ORIG_COST_CTR
FROM `C:\Documents and Settings\jgwynn\Desktop\TechSingleInvoice`.`emea1-3` `emea1-3`
WHERE (`emea1-3`.ORIG_COST_CTR=?)

If I source the parameter for "orig_cost_ctr" as say sheet2!b4, and leave the cell blank, nothing is returned, in this case I want everything to be returned.)
0
 
LVL 17

Expert Comment

by:walterecook
ID: 10939646
Therein lies the problem.  It sees it as empty and is thus looking for data that = ""
You'll probably need to evaluate that cell first with an if. If it's empty use the query with no where clause.  If it isn't, use the current query.

Walt
0
 

Author Comment

by:JGWY
ID: 10939791
is there not a wildcard that can be inserted into the cell that represents all fields?

I'm thinking of using around 5 parameters and this could be really messy if i have to evaluate all first?
0
 
LVL 17

Accepted Solution

by:
walterecook earned 50 total points
ID: 10940756
There is and it is *
But you are saying make the condition = to the contents of the cell.  The cell is empty which is ""
So the query says "ok find me records that = ""

Walt
0
 
LVL 5

Expert Comment

by:usarian
ID: 11094387
If I could make a suggestion,  How about triggering a small vba routine to perform the query if the cell contains, say the word "all"?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question