Solved

IIf issue

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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