Results 1 to 2 of 2
  1. #1
    erin.tpt is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    1

    Conditional Statements in Criteria (using ODBC Tables)

    I am looking for some help to solve an issue with duplicates being pulled from the ODBC tables that I am using. Just as some background, our database has the option for multiple salutation codes on a single account. Not all of the accounts that I need to pull have the preferred salutation that I need.



    The end product that I would like to show is:

    IF "Preferred" exists, show that salutation,
    if "Preferred" does not exist, show "default".

    At the moment, I am getting the default for all accounts and duplicates for those with a preferred salutation using this statement:

    =IIf([SALUTATION_CODE]="PREFERRED","PREFERRED","DEFAULT")

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    You are close. The syntax is generally correct.

    But [Salutation_Code] is a field name
    "PREFERRED" is a value

    I don't think you really want "PREFERRED" as a salutation.

    What are the fields in your table?

    I can foresee a situation like this.
    Let's say that the default_Salutation for the run is "Mr."

    The Contact table has a field called preferred_Salutation.
    For Conatct_Number 123 let's say the value of preferred_Salutation is "Ms"
    For Conatct_Number 200 let's say there is no value in preferred_Salutation

    So using
    iif(Len(Preferred_Salutation) >0,Preferred_Salutation, Default_Salutation)
    123 will have Ms
    200 will have Mr.

    All this is saying is
    if there is a preferred_Salutation, then use it
    if there is no preferred_Salutation, then use the default.

    Good luck


    PS - I don't see where ODBC has anything to do with this

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Combining ODBC linked tables
    By sirlosi in forum Queries
    Replies: 7
    Last Post: 03-10-2011, 02:43 PM
  2. Replies: 3
    Last Post: 10-13-2010, 03:35 PM
  3. If statements criteria
    By BED in forum Forms
    Replies: 4
    Last Post: 07-23-2010, 12:52 PM
  4. if record exists...conditional query criteria
    By mbryanr in forum Queries
    Replies: 2
    Last Post: 02-12-2010, 11:50 AM
  5. ODBC Linked Tables Become Unupdateable
    By dollardeveloper in forum Access
    Replies: 0
    Last Post: 04-08-2009, 07:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums