Solved

IIF syntax, if null return all problem

Posted on 2008-10-06
4
601 Views
Last Modified: 2013-11-05
MS Access 2003
I need help with my syntax.

IIF([district1] is null, like "*" or NZ([district]), [district1])

This is my criteria, [district1] is undefined and gives a msgbox(think thats the term, pops up asking for a value).

[district] is the field for which i am trying to establish a criteria.

What i want is to return all lines unfiltered when nothing is typed into the msgbox.
what i get is this "this expression is typed incorrectly or is toocomplex to be evaluated...."

can you help please.
I'd prefer not to do this in vb but can if needed
Thank you
0
Comment
Question by:norris900
[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
4 Comments
 
LVL 7

Expert Comment

by:Norush
ID: 22648751
What do you want your query to do ?

Are [district] and [district1] 2 different fields and are they in the same table?
What is their datatype?
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 22648769
what about this:
WHERE [district] LIKE NZ([district1], '*')

Open in new window

0
 

Author Comment

by:norris900
ID: 22648812
[district] is a text field in my table

[district1] is a undefined criteria for the field [district]

e.g.
select table1.district from table1 where (((table1.district)=[district1]));

I want the query to return all data when no criteria is entered by the user in the msgbox that pops up
0
 

Author Closing Comment

by:norris900
ID: 31503353
Thanks was being a bit slow even for me on a monday morning :)
Perfect solution
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

635 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