How to make controls invisible on a report in real time

Gkirkup

Registered User.
Local time
Yesterday, 16:51
Joined
Mar 6, 2007
Messages
628
I have a report on which two controls are not to be visible if the Yes/No field STOCKDISC is false. I have tried the second code routine in report open, the report does not print. I then tried the same routine in report activate. The report ran, but the two controls still appeared when STOCKDISC was false. How do I get the two controls to be invisible if STOCKDISC is false?

Robert

Code:
[FONT=Arial]Private Sub Report_Activate()[/FONT]
[FONT=Arial]If [STOCKDISC] = False Then[/FONT]
[FONT=Arial]   Me.STOCKDISC.Visible = False[/FONT]
[FONT=Arial]   Me.LabelStock.Visible = False[/FONT]
[FONT=Arial] End If[/FONT]
[FONT=Arial]End Sub[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]Private Sub Report_Open(Cancel As Integer)[/FONT]
[FONT=Arial]  If [STOCKDISC] = False Then[/FONT]
[FONT=Arial]    Me.STOCKDISC.Visible = False[/FONT]
[FONT=Arial]    Me.LabelStock.Visible = False[/FONT]
[FONT=Arial]  End If[/FONT]
[FONT=Arial]    [/FONT]
[FONT=Arial]End Sub[/FONT]
 
Try using your code in the OnFormat event of the section where your controls are located.
 
Yes, that worked perfectly. Thank you!

Robert
 

Users who are viewing this thread

Back
Top Bottom