Results 1 to 4 of 4
  1. #1
    sfgiantsdude is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    34

    new query field based on existing field logic

    I'm trying to create a new field based on two existing fields as part of a select query. Two tables in the query each have a "HOSPITAL" field which is an indicator for "Y" or "N" for each department (in the DEPTLOOKUP table) and for each facility (in the Facility Lookup table). I want to create a field whereby a new indicator is created so that a Y is given for each record only where the facility and department HOSPITAL indicator field is both "Y". I have attached a word document that has a screenshot of the query in design view as well as the access sql code. Please let me know if you need any clarifying questions. Thank you!
    Attached Files Attached Files

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    How about:

    NewFieldName: IIf(DEPTLOOKUP.Hospital = "Y" AND [Facility Lookup].Hospital = "Y", "Y", "N")

    Edit: Go Giants!!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    These are text fields, not Yes/No Boolean type?

    Maybe:

    IIf([Facility Lookup].[Hospital] = "Y" And [DeptLookup].[Hospital] = "Y", "Y", "N")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    sfgiantsdude is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    34
    this works! thanks so much!

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

Similar Threads

  1. Replies: 3
    Last Post: 07-25-2014, 11:15 AM
  2. Replies: 29
    Last Post: 04-25-2014, 03:49 PM
  3. Replies: 3
    Last Post: 07-30-2013, 12:11 PM
  4. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  5. Replies: 1
    Last Post: 08-31-2011, 04:03 PM

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