hide unchecked checkboxes on a report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • WyvsEyeView
    New Member
    • Jul 2008
    • 46

    hide unchecked checkboxes on a report

    I have a report on which each record could potentially display three checkboxes...ca ll them chk1, chk2, chk3. To minimize clutter on the page, I only want to display the labels of the checkboxes that are checked. I have not been able to find any way to test the value of these checkboxes using any of the report events. Access's conditional formatting doesn't allow you to hide a control based on conditions. Any ideas? Thanks!
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Actually, you can hide a control using Conditional Formatting, you just have to be tricky and change the Fore color if the condition is met! But you can't use CF for anything with checkboxes, so you need to be tricky again. There may be a slicker way to do this, but this will work!

    First off, create a small rectangle and place it over each checkbox. Name them chk1Cover, chk2Cover and chk3Cover. Set their Border Style to Transparent. Now place this code behind your report:
    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
     If Me.chk1 = 0 Then
      Me.chk1Cover.Visible = True
     Else
      Me.chk1Cover.Visible = False
     End If
    
    If Me.chk2 = 0 Then
      Me.chk2Cover.Visible = True
     Else
      Me.chk2Cover.Visible = False
     End If
     
    If Me.chk3 = 0 Then
      Me.chk3Cover.Visible = True
     Else
      Me.chk3Cover.Visible = False
     End If
     
     End Sub
    Linq ;0)>

    Comment

    Working...