Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2004
    Posts
    34

    Unanswered: Hide Checkbox on report

    I have a frm that gives user several check boxes. After filing the form out and checking the appropriate boxes, the user will print a report. I want the report only to print the check boxes that have been selected. I'm new to code and have looked into this but have no idea? anY HELP

    ed

  2. #2
    Join Date
    Sep 2003
    Posts
    228
    there is a visible property for checkboxes.

    In the format event for you report:

    Code:
    if checkbox.value = 1 then
       checkbox.visible = true
    else
       checkbox.visible = false
    endif

  3. #3
    Join Date
    Aug 2004
    Posts
    34

    ON open Event?

    Do I place this code for the ON OPEN event of the report? and do I need to put it in for each check box? Sorry, I am a little confused

  4. #4
    Join Date
    Sep 2003
    Posts
    228
    You will want to use the OnFormat event.

    You will have to use an if statement for each checkbox. How many do you have? That is the easiest way...

    A more complicated way would be to write a function that takes a control as a parameter and this function would set the passed in control's visible property based on its value.

  5. #5
    Join Date
    Aug 2004
    Posts
    34

    Using Access2k

    I don't see that event listed for the report. I have 6 check boxes being saved to table as a yes/no data type. I have looked in form, checkbox and report properties under events and still can't find one for OnFormat

    Sorry...I found it in the properties of the detail section on my report. I use the code that you offered substituting the name of my chk. I keep getting an error in the code. after the else statement. any idea???

    Thanks
    ED
    Last edited by Falcon049; 11-08-04 at 16:56.

  6. #6
    Join Date
    Sep 2003
    Posts
    228
    I am sorry... The onformat event is where the code should go (for the section where the checkboxes are on).

    You may have to compare the value of the checkboxes to true/false instead of 0/1

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If checkbox.Value = True Then
        checkbox.Visible = True
    Else
        checkbox.Visible = False
    End If
    
    End Sub
    please post any error message you get in detail

Posting Permissions

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