IIF statement problems.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mr Hero
    New Member
    • Oct 2010
    • 16

    IIF statement problems.

    I need assitance with my IIF statement.

    IIf([Reports]![RptMaster]![ChkBxs]="1",True,II f([Reports]![RptMaster]![ChkBxs]="2",False,I If([Reports]![RptMaster]![ChkBxs]="3",,)))

    I have a column in my table that stores values from a check box in my form.

    I have a form that has a option group in it, and it has 3 buttons to select from. Depending on the value, you can get 1, 2 or 3 as your value; hence my IIF statement. Selection "1" will allow my report to filter my data for only checked boxes to display on my report. Selection "2" will allow my report to filter my data for only unchecked boxes to display on my report. Selection "3" is suppose to show all of them, but I am having dificulty with this. Can anyone help me figure this out?

    Thanks in Advance.
  • gnawoncents
    New Member
    • May 2010
    • 214

    #2
    Try this instead:

    Code:
    IIf([Reports]![RptMaster]![ChkBxs]="1",True,IIf([Reports]![RptMaster]![ChkBxs]="2",False,IIf([Reports]![RptMaster]![ChkBxs]="3","*",)))
    Also, do you need the option for if nothing is selected? If not, you could go with:

    Code:
    IIf([Reports]![RptMaster]![ChkBxs]="1",True,IIf([Reports]![RptMaster]![ChkBxs]="2",False,"*"))
    For either of these to work properly, you would need the criteria to evaluate to "[TableColumn] Like IIf..."

    Let me know if you have any questions.

    Comment

    • Mr Hero
      New Member
      • Oct 2010
      • 16

      #3
      Gnawoncents,

      I tried both of your suggestions, the first one gave me a error message saying it was too complex. The other one nothing showed...

      Comment

      • gnawoncents
        New Member
        • May 2010
        • 214

        #4
        Once you get the result from the IIF statement, how are you using it? Please be as specific as you can. That will give me a better idea of what you need.

        Comment

        • Mr Hero
          New Member
          • Oct 2010
          • 16

          #5
          Okay, these are the steps:
          1. When the Main report opens, it bring a form that has 2 fields for Dates, then There is a option group below the fields. (this is were I click to select what type of filtering is needed.)
          2. Next, I click on the preview button which then opens my report.

          I have attached a sample of the database.

          Thanks again.

          Mario
          Attached Files

          Comment

          • gnawoncents
            New Member
            • May 2010
            • 214

            #6
            Okay,

            I did my best to leave most of your coding intact. I modified some VBA and the SQL for a record source or two. Let me know if you have any questions.
            Attached Files

            Comment

            Working...