Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601

    Unanswered: Using a value to exclude records based on a combo

    Hey,

    I have a small form that holds all my Reports in Access. The Reports all are formated the same except for a few. In general the reports use a query to filter. And that Query looks at a combobox on the form. What I am trying to do now is if the combobox equals a value exclude a record.
    Code:
    IIf([forms]![SelectReport1]![combo7]="ABC",
    ([Employees].[LastName])<>"Johnson",
    [forms]![Selectreport1]![combo7])
    So to explain: if the combo= ABC exclude record w/ last name Johnson. Ultimately I need to also have if the combo = "ABD" exclude Wallace.

    Also in the combo I added All. How can I make it when the combo equals all don't filter.

    Thanks
    Ryan
    My Blog

  2. #2
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Any ideas??
    Ryan
    My Blog

  3. #3
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    Maybe this will help by basing your query results on whether "Johnson", "Wallace", or anything else is selected in the combo box:

    Type in the field cell of the query grid:

    IIf([Forms]![SelectReport1].[Combo7]="ABC",[Employees].[Last Name]<>"Johnson",(IIf([Forms]![SelectReport1].[Combo7]="ABD",[Employees].[Last Name]<>"Wallace",[Employees].[Last Name] Is Not Null)))

    In the criteria section, enter "<> 0" (without the quotes).
    Uncheck the Show box.

    Jerry

  4. #4
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    Maybe this will help by basing your query results on whether "Johnson", "Wallace", or anything else is selected in the combo box:

    Type in the field cell of the query grid:

    IIf([Forms]![SelectReport1].[Combo7]="ABC",[Employees].[Last Name]<>"Johnson",(IIf([Forms]![SelectReport1].[Combo7]="ABD",[Employees].[Last Name]<>"Wallace",[Employees].[Last Name] Is Not Null)))

    In the criteria section, enter "<> 0" (without the quotes).
    Uncheck the Show box.

    Jerry

  5. #5
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    Maybe this will help by basing your query results on whether "ABC", "ABD", or anything else is selected in the combo box:

    Type in the field cell of the query grid:

    IIf([Forms]![SelectReport1].[Combo7]="ABC",[Employees].[Last Name]<>"Johnson",(IIf([Forms]![SelectReport1].[Combo7]="ABD",[Employees].[Last Name]<>"Wallace",[Employees].[Last Name] Is Not Null)))

    In the criteria section, enter "<> 0" (without the quotes).
    Uncheck the Show box.

    Jerry

  6. #6
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    My apologies for so many replies because of slow system response leading to a blank page, which caused me to think the reply failed. I edited my last response.

    Jerry

  7. #7
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Oh I'll try that, but I tried similar iif statement in the criteria field.


    [edit]Nope
    Last edited by rguy84; 08-26-04 at 12:30.
    Ryan
    My Blog

Posting Permissions

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