Displaying a checkbox on a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to display a check box on a report so that if the control
source is equal to a particular value, it will dispaly as a check mark in the
box?
 
Sure. For the sake of an example, lets say we have an unbound checkbox in
the detail section of a report. For the exaple, let's say the name of the
checkbox is chkIt. Let's also say that the detail section has a field named
txtChecker, the value of which determines whether or not chkIt displays.
Let's also say for the example, that we want chkIt to display, checked, if
the value of txtChecker is > 100. If the value of txtChecker is <= 100,
txtChecker won't display.

In the On Format event of the detail section of the report, one might write
an event procedure as follows:

Private Sub Detail_Format (Cancel As Integer, FormatCount As Integer)
If Me.txtChecker > 100 Then
Me.chkIt = True
Me.ckkIt.Visible = True
Else
Me.chkIt = False
Me.chkIt.Visible = False
End If
End Sub

Strictly speaking, one would not need to set the value of chkIt to true and
false in the code; one could set the value of chkIt to True and leave it
alone and just turn the visibility on and off...

Hope this helps.

TL
 
Back
Top