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
Solved

IIf issue

Posted on 2014-01-29
3
325 Views
Last Modified: 2014-01-29
I have this in the default value of a field on a form.

=IIf([Forms]![frmCustomers]![subfrmPets].[Form]![cboSpecies].[Column](1)<>"Cat" Or "Dog",True,False)

What I want to have happen is the checkbox (which is what this field is), needs to be checked (true) if [Forms]![frmCustomers]![subfrmPets].[Form]![cboSpecies].[Column](1) is not "Dog" or "Cat".

If it is either "Dog" or "Cat" then it should not be checked.

What is wrong with my syntax?

--Steve
0
Comment
Question by:SteveL13
3 Comments
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 39818188
=IIf([Forms]![frmCustomers]![subfrmPets].[Form]![cboSpecies].[Column](1)<>"Cat" Or [Forms]![frmCustomers]![subfrmPets].[Form]![cboSpecies].[Column](1)<>"Dog",True,False)
0
 
LVL 3

Accepted Solution

by:
DEVLitehouse earned 500 total points
ID: 39818203
You must directly compare both values. Also, if you're trying to make it so neither values are matched, you'll need to use "And" rather than "Or". So your code should look like this:
=IIf([Forms]![frmCustomers]![subfrmPets].[Form]![cboSpecies].[Column](1)<>"Cat" And [Forms]![frmCustomers]![subfrmPets].[Form]![cboSpecies].[Column](1)<>"Dog",True,False)

Open in new window

0
 

Author Comment

by:SteveL13
ID: 39818214
Not quite right.  It is checked even if  [Forms]![frmCustomers]![subfrmPets].[Form]![cboSpecies].[Column](1) = "Cat"
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
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…

840 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