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

x
?
Solved

IIF syntax, if null return all problem

Posted on 2008-10-06
4
Medium Priority
?
604 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 200 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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

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…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 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