Make Visible (1 Viewer)

MaleNurse325

Registered User.
Local time
Today, 06:30
Joined
Jan 11, 2016
Messages
67
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.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:30
Joined
May 21, 2018
Messages
8,516
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
 

isladogs

MVP / VIP
Local time
Today, 14:30
Joined
Jan 14, 2017
Messages
18,207
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

Top Bottom