Report label won't hide

G

Guest

Hi!
On a report, I want to show all cell phone labels where a cell phone number
exists. However, I also want to hide a cell phone label where the city is San
Francisco. The following does not hide the cell phone label ....what am I
doing wrong?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Label62.Visible = (Me.SanFranciscoControl = False)
Me.Cell.Visible = (Me.CellLineControl = True)
Me.Label62.Visible = (Me.CellLineControl = True)
Me.Cell.Visible = (Me.SanFranciscoControl = False)
End Sub

Thank you, Petra
 
J

John Spencer

Do you want to hide the label and the cell control or just the label? You
need to decide to hide/show the controls on the basis of CellLineControl.
Then if they are showing, you need to show/hide them based on the
SanFrancisco control.

One method of doing that is

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'One method.
Me.Label62.Visible = (Me.CellLineControl = True)
Me.Cell.Visible = (Me.CellLineControl = True)
'Show/Hide label if CellLineControl is True based on SanFrancisco Control
If me.CellLineControl= True then
Me.Label62.Visible = (Me.SanFranciscoControl = False)
Me.Cell.Visible = (Me.SanFranciscoControl = False)End if
End IF
End Sub
 
G

Guest

Works nicely, thank you!

John Spencer said:
Do you want to hide the label and the cell control or just the label? You
need to decide to hide/show the controls on the basis of CellLineControl.
Then if they are showing, you need to show/hide them based on the
SanFrancisco control.

One method of doing that is

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'One method.
Me.Label62.Visible = (Me.CellLineControl = True)
Me.Cell.Visible = (Me.CellLineControl = True)
'Show/Hide label if CellLineControl is True based on SanFrancisco Control
If me.CellLineControl= True then
Me.Label62.Visible = (Me.SanFranciscoControl = False)
Me.Cell.Visible = (Me.SanFranciscoControl = False)End if
End IF
End Sub
 
M

Marshall Barton

Petra said:
On a report, I want to show all cell phone labels where a cell phone number
exists. However, I also want to hide a cell phone label where the city is San
Francisco. The following does not hide the cell phone label ....what am I
doing wrong?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Label62.Visible = (Me.SanFranciscoControl = False)
Me.Cell.Visible = (Me.CellLineControl = True)
Me.Label62.Visible = (Me.CellLineControl = True)
Me.Cell.Visible = (Me.SanFranciscoControl = False)
End Sub


First, make sure the label is attached to the text box (if
you drag one, the other should move with it). Since
attached labels are visible only when their associated text
box is visible, you only need to work on the text box.

If the SanFranciscoControl is a True/False check box and if
CellLineControl is Null when there is no number, then all
you need is something like:

Me.Cell.Visible = Not (IsNull(Me.CellLineControl) _
Or SanFranciscoControl)
 

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

Top