Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

access iif Wildcard in Query

Posted on 2011-03-06
4
Medium Priority
?
682 Views
Last Modified: 2012-05-11
Sorry this is so basic but...struggling.

I have a dropdown that I need to change and then the Query adjusts

Looks like this:
ddBizProcess  (data)
0 = All
1 = xxx
2 = yyyy

In the appropriate field in query design I have

IIf([Forms]![test]![ddBizProcess]>0,[forms]![test]![ddBizProcess],"*")


I keep getting an error.

basically if they select all then bypass the criteria  if not match the field.

hmmm...

tnx experts
0
Comment
Question by:skillilea
  • 2
  • 2
4 Comments
 
LVL 75
ID: 35049256
Try this


IIf([Forms]![test]![ddBizProcess]>0,[forms]![test]![ddBizProcess],[TheNameOfTheCriteriaField])
                                                                match the field itself        ^^^^^^^^^^^^^^^^^^^^^

mx  
0
 

Author Comment

by:skillilea
ID: 35049572
IIf([Forms]![test]![ddBizProcess]>0,[forms]![test]![ddBizProcess],[TheNameOfTheCriteriaField])


ddBizProcess = the DropDown that has the choices

if ddBizProcess is empty (NULL) or user selected ALL ( value  = 0) then I want to show ALL records or "*"   ELSE I want to match ddBizProcess to the field CRTYpeID

population of ddBizProcess is:

SELECT crTypeID From ....

tnx

sorry for the confusion
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 35049940
What is the Name of the Field in the query that you are using this criteria on?
Substitute that for TheNameOfTheCriteriaField  in the expression below. I also added the case for Null which you didn't mention before.

IIf( Nz([Forms]![test]![ddBizProcess],0) >0, [forms]![test]![ddBizProcess],[TheNameOfTheCriteriaField])

0
 

Author Closing Comment

by:skillilea
ID: 35050076
Sorry for the confusion and thanks for the help.  You had it the first time.

tnx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

963 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