Hidden text boxes are printing when they shouldn't

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

I have some controls on a report(labels and text boxes)
that are conditionally hidden using code. They are indeed
hidden when the report is viewed (in print preview) on the
screen, but they reappear when the report is actually
printed.
Thanks in advance to anyone who can help.
 
Sure,
The same code runs on two events- On Activate and On Page.
I should also mention that the formatting (when printed)
seems to vary on different printers. This leads me to
believe that the application is not at fault but perhaps
the printers are.

Anyway, here is the code;

Private Sub Report_Activate()
On Error GoTo except

Dim sngpercent As Double

DoCmd.Maximize
sngpercent = Me.PercentageShare

If sngpercent = 1 Then

'MsgBox "full share"
lblpercentageShare.Visible = False
PercentageShare.Visible = False
lblsplitP_LAUD.Visible = False
SplitP_L_AUD_.Visible = False

Else: 'MsgBox "part share"

Me.txtcomment.Top = 5450
lblpercentageShare.Visible = True
PercentageShare.Visible = True
lblsplitP_LAUD.Visible = True
SplitP_L_AUD_.Visible = True

End If
Exit Sub
except: MsgBox Err.Description
End Sub
 
There is no Activate event when printing to a printer. Your code should be
in the On Format event of the section containing the controls.
 
Back
Top