Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

access iif Wildcard in Query

Posted on 2011-03-06
4
Medium Priority
?
672 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
[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
  • 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

704 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