Solved

IIf issue

Posted on 2014-01-29
3
327 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
[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
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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 …
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…
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…

739 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