Visibility problem

  • Thread starter Thread starter CJ
  • Start date Start date
C

CJ

Hi Groupies!!

I am trying to make a field invisible based on the content of another field.
I don't think this should be that difficult, but I am unable to find out how
to do it.

My code is as follows:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me.strDeptName = "Occupational Therapy" Then Me.SumOflngPufHrsPT
Visible = False
End Sub

I keep receiving the error "Invalid Use of Property" when I try to compile.

Can somebody please help me with this?

Thanks
CJ
 
CJ said:
I am trying to make a field invisible based on the content of another field.
I don't think this should be that difficult, but I am unable to find out how
to do it.

My code is as follows:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me.strDeptName = "Occupational Therapy" Then Me.SumOflngPufHrsPT
Visible = False
End Sub

I keep receiving the error "Invalid Use of Property" when I try to compile.


While Jeff answered your specific question, I would like to
point out that you should use the Format event to do this.
The reason is that, if the control's CanShrink property is
set to Yes, it will shrink when it is invisible. Shrinking
takes place after the Format event and before the Print
event so the Print event is too late.

The general guideline is to use the Format event for actions
that affect the layout of the report and use the print event
foe actions that need to know how items were layed out.
 
Thanks to both of you.

I had used the Format event at first, but thought that might be part of the
problem.

Cheers!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top