Results 1 to 2 of 2
  1. #1
    tjb1 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Posts
    4

    Select value if available, otherwise use specified value

    This is my current table ( see attached ) and the form ( see attached ) and when I enter 00 as the type in the form, I want it to return only records that have 00. If I enter 01 or any other number that isn't 00 as the type, I want it to return only the records that have XX. 00 and 01 are not constants, they can be anything from 00 to 93. I've tried using iif statements but I can't get it to return values the way I want and I'm not very knowledgeable with SQL to do it that way.



    What I am trying to do here is exclude results. There will always be a record with the type as XX so if the user enters a type that does not have a record it will return the XX record but if the user enters say type 54 and there is a record that matches everything else and has a type of 54 I want it to return that one.
    Attached Thumbnails Attached Thumbnails table.jpg   form.jpg  

  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,521
    I'm not sure of your goal, as there seem to be two different questions. Either way, I'd use code behind the button that tests the input, then sets the source of the subform or listbox as appropriate. If the second paragraph is the real goal, you can use DCount() to see if there are any records first.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 05-14-2014, 01:17 PM
  2. Replies: 1
    Last Post: 10-08-2012, 09:01 AM
  3. Replies: 5
    Last Post: 07-26-2012, 12:59 PM
  4. Replies: 8
    Last Post: 04-21-2011, 05:29 PM
  5. Replies: 1
    Last Post: 10-22-2010, 10:11 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