Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8928637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:29:20+00:00 2026-06-15T08:29:20+00:00

I have an Access 2007 query. In the criteria, I need it to select

  • 0

I have an Access 2007 query. In the criteria, I need it to select all records if a filter in a form is set to “View all organisations”. However, I can’t get it to work. Criteria below:

=IIf([Forms]![Reports]![Referrals - Business Filter]="View all organisations","Like '*'")

The criterion works in general – if I change “Like ‘*'” to something specific, e.g. “Barclays”, then it selects the correct contacts listed under that business, but that’s not what I want to achieve.

What am I doing wrong?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:29:21+00:00Added an answer on June 15, 2026 at 8:29 am

    You’ve hit on something interesting! The “Like *” you’re trying to get the query to evaluate is not a literal string, but a logical expression (which evaluates to True or False).

    When you’re switching between different comparison expressions in SQL using Iif (strictly, Iif is Access VBA, not SQL, but Access allows you to use VBA to an extent in queries), you can only switch between literal values. e.g. 1, 453.5, “This”, “A customer name”.

    Switching to a “LIKE *” expression amounts to writing SQL on the fly. It’s like me saying “I ‘ve had (Iif(It’s Friday, (5-4), (6/2)) cups of coffee today”. Your brain can handle this switch in context from literal English to something that has to be evaluated (and amounts, today, to the English literal word “one”); so can Access – to a certain extent. But not to the extent of evaluating this:

    [AColumn] = "Like *"
    

    and interpreting it to mean

    [AColumn] LIKE "*"
    

    THe way round it is to break out the check whether “View all” is selected into a separate test:

    WHERE
    ([Selection on the form]="View all") OR
    ([AColumn]=[Selection on the form])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a saved query in MS Access 2007 named test. SELECT Count(system_info.id) AS
In an MS Access 2007 project report, I have the following (redacted) query: SELECT
Access 2007 / SQL / VB I have a query: SELECT Count(*) AS CountOfCR1
I have an advanced query/report that I need help creating in Access 2007. The
I have a query in Access 2007. It's worked fine for months, but I'm
I have a table in an Access 2007 database. All fields are of type
I have a MS Access 2007 report which is based on a query that
I have an access 2007 table with about 3000 records, to which I have
In Access 2007 (or 2010), I need to set the properties on a subform,
Access 2007: We need a query to link two tables without using a unique

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.