Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Melbourne, Victoria, Australia
    Posts
    139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    NOT ing a criteria

    I am using A97 and I have a combo box which I use in the criteria section of a query. It is a text field containing 4 alphanumeric codes, identifying cost centres.

    the criteria field contains the following
    Like [Forms]![frm Main]![CmboCostCentre]

    This works fine but I also need to give the user the choice of returning records which do NOT meet the criteria.

    Like 21*
    is OK, but I need also to be able to do
    Not Like 21*

    Both of these choices need to be able to be selected from the combo box. Currently it gets the choices from a value list.

    Regards
    Michael

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: NOT ing a criteria

    I would recommend a checkbox near the criteria list for the user to be able to exclude the selected criteria (maybe labeled "Excluding"...or something)

    In your criteria, you could place an IF...Then statement (or IIF(), depending on whether or not you're using code) to test whether or not the checkbox is selected:

    If [Forms]![frmMain]![chkExclude] = True Then
    strCriteria = "Not Like " & [Forms]![frmMain]![CmboCostCentre]
    Else
    strCriteria = "Like " & [Forms]![frmMain]![CmboCostCentre]
    End If

    [img]/w3timages/icons/2cents.gif[/img]

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Melbourne, Victoria, Australia
    Posts
    139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: NOT ing a criteria

    Thanks Mark,
    It certainly helps to be presented with a different view of the problem/challenge.
    You have started me thinking of other areas that might benefit from this approach.
    Regards
    Michael

Posting Permissions

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