Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo Returns True or All (A2K)

    I have found a simple way of returning "true" (or false) or

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Combo Returns True or All (A2K)

    Rupert, was this in response to a particular problem or question? If so, it might be useful if there were a link to the thread that prompted it.
    Charlotte

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Combo Returns True or All (A2K)

    Ok, so in what situation would I use this? It is true that some boolean fields can contain True, False or be Null and that tends to be a little tricky if you want to see all values, but I don't think that's where you were headed. Can you expand your explanation? Thanks.
    Wendell

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Returns True or All (A2K)

    I've just realised it can be further simplified:

    IIf([Forms]![frmMainQuote]![grpAllUpdated],True,True) Or [Forms]![frmMainQuote]![grpAllUpdated]

    >>>>>some Boolean fields can contain True, False or be Null<<<<<

    Wendell,
    I haven't tried this on a Boolean field with Null values, so I can't comment on that.

    >>>>>>was this in response to a particular problem or question?<<<<<

    Charlotte,
    I "discovered" this whilst upgrading a quote systems database. I suspect I'm not the first person to use this method, but I've never seen it mentioned on any hints and tips pages.

    Uses.
    Good question this, uses. If a record has a true/false field, and you Filter your records on this field it is likely that you will either want to see true or false results. However I have a situation where the combo box displays a list of the same product from different suppliers. The prices vary and the operator usually picks the cheapest ones. Sometimes due to logistics/time constraints it is necessary to use a dearer product. Historically the industry has a price increase in March so all the prices have to be updated in a very short space of time during March. This results in the list containing old prices and new prices, flagged by a Boolean field. Normally the operator would only want to see new prices but on occasions it is necessary to view the full list.

    The only other situation where this might be useful that springs to mind is a combo box for selecting a customer that is restricted to show only customers who have good credit. So the list wouldn't show customers that were on the stop list. However on occasions you may want to see a full list of customers.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Returns True or All (A2K)

    I'm confused <img src=/S/confused.gif border=0 alt=confused width=15 height=20>. Am I missing something? It seems to me that IIf([Forms]![frmMainQuote]![grpAllUpdated],True,True) *ALWAYS* returns True. And since (True Or Anything) is always True, the whole expression you propose always evaluates to True.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Combo Returns True or All (A2K)

    Actually, if the control in question is a checkbox, doesn't it need the full syntax of [Forms]![frmMainQuote]![grpAllUpdated]=True to avoid a memory leak and other possible repercussions since it's referencing a control, not a True/False field? As stated, it will always return True since both conditions specify a True as the result. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Charlotte

  7. #7
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Returns True or All (A2K)

    Thanks Hans, you're absolutely right, I missed that! It further simplifies to just "True" so it should read:

    True Or [Forms]![frmMainQuote]![grpAllUpdated]

    And I tried it and it works.

    So

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •