Make Visible

MaleNurse325

Registered User.
Local time
Today, 06:22
Joined
Jan 11, 2016
Messages
72
I have a check box on a form. I'd like, when it is selected to make a field ( A text box ) called [DanGo] visible on the report generated [rptConsignNote] only when the check box is checked. I hope that makes sense.
 
Probably need something in the reports open arg

Code:
Private Sub Report_Open(Cancel As Integer)
  Dim fieldToHide As String
  fieldToHide = Me.OpenArgs & ""
  If Not fieldToHide = "" Then
    Me.Controls(fieldToHide).Visible = False
  End If
End Sub

Then pass in what you want to hide
Code:
Public Sub testit()
  DoCmd.OpenReport "tblCars", acViewPreview, , , , "carID"
End Sub
 
You can do this in various ways including using open args when opening your report
For example on your form have code similar to this

SQL:
Dim blnCheck As Boolean

blnCheck = Me.CheckboxName
DoCmd.OpenReport "ReportName",acViewPreview,,,,blnCheck

Then in your report use

SQL:
Private Sub Report_Open(Cancel As Integer)
    Me.TextBoxName.Visible = Me.OpenArgs
End Sub
 

Users who are viewing this thread

Back
Top Bottom