When Checkbox is Checked on Form, want report to print Yes/No

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jinfo
    New Member
    • Dec 2008
    • 3

    When Checkbox is Checked on Form, want report to print Yes/No

    I was assigned the task of creating a small database by my office.
    I created a table with the appropriate field ID, Project, and Approve (checkbox). Then I created a Form of the table.

    But when I run my reports I see the actual check boxes. I am trying to understand what I am doing wrong.

    What I would like to happen is when a person clicks the approve check box it says yes on the report, and when the check box is not checked it should say no.

    Any help would be greatly appreciated.
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    On the report make the check box control invisible but don't delete it. Assuming check box is called "Check1" then do the following.

    Add a new text box control to the report and place it where you want the "Yes" to display. Set the control source of the new check box to the following.

    Code:
    =IIf([Check1]=-1,"Yes","No")

    Comment

    • jinfo
      New Member
      • Dec 2008
      • 3

      #3
      Thank You

      It worked thank you, I have a question im new to programming what does the IIF mean?

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        IIf(<expression >,If True, If False)

        It is essentially an IF statement. Essentially it says if whatever expression you use before the first comma is true then use value between first and second comma otherwise use value after second comma.

        You can use any expression before the first comma in the form of ...

        Code:
        [Field Name]="xxx" (for a string)
        [Field Name] Like "Bl*" (when you want all strings beginning with Bl)
        [Field Name]=2 (For a number)
        [Field Name]>2 (For all numbers higher than 2)
        [Field Name]<2 (For all numbers lower than 2)
        [Field Name]=#22/10/2008# (For a date)

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          To continue Mary's explanation, IIF stands for Imediate IF. Essentially it's a shortcut for

          Code:
          If <whatever> Then
            <Do this>
          Else
            <Do something else>
          End If
          Welcome to Bytes!

          Linq ;0)>

          Comment

          • jinfo
            New Member
            • Dec 2008
            • 3

            #6
            Thank You

            I got it to work, but I must have misunderstood what I was suppose to do. The check box is fine but what they wanted was two check boxes. One that says "Yes" and another box next to it that say "No". Depending on which box you check the word should be written on the report.

            I have to pics of my project so far. Can something like this be done?
            Attached Files

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32653

              #7
              Radio Buttons are better for such, mutually exclusive, options. If Yes=True then No=False and If Yes=False then No=True.

              An Option Group control will be required to contain the Radio Buttons.

              On the report a TextBox with a value of something like :
              Code:
              =IIf(optGroup=1,"Yes","No")

              Comment

              Working...