By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,482 Members | 2,411 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,482 IT Pros & Developers. It's quick & easy.

hide unchecked checkboxes on a report

WyvsEyeView
P: 46
I have a report on which each record could potentially display three checkboxes...call 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!
Aug 5 '08 #1
Share this Question
Share on Google+
1 Reply


missinglinq
Expert 2.5K+
P: 3,532
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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2.  If Me.chk1 = 0 Then
  3.   Me.chk1Cover.Visible = True
  4.  Else
  5.   Me.chk1Cover.Visible = False
  6.  End If
  7.  
  8. If Me.chk2 = 0 Then
  9.   Me.chk2Cover.Visible = True
  10.  Else
  11.   Me.chk2Cover.Visible = False
  12.  End If
  13.  
  14. If Me.chk3 = 0 Then
  15.   Me.chk3Cover.Visible = True
  16.  Else
  17.   Me.chk3Cover.Visible = False
  18.  End If
  19.  
  20.  End Sub
Linq ;0)>
Aug 5 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.