Show label based on yes/no check box contents

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can any one help? I would like for a label (Label32) on a report to be
Invisible unless a check box = yes. Can I use an If statement on a report?
Any ideas? Neither the Label or Check Box have any Event Properties, please
help!!!
 
Use the Format event of the report Section that contains the controls.
Sections include the Report Header and Footer sections, the Page Header and
Footer sections, the Detail section, and if you have added them, one or more
Group Header and Footer sections. Your label and check box are *probably* in
the Detail section, but without seeing your report I can't be sure.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
My label and check are both in the detail section of the report. I've tried
this code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If [Inter Depot Transport] = Yes Then
Label32.Visible = False
End If

End Sub

I get the error message "You have entered an expression with no value",
please excuse my ignorance. Can you see the problem?
 
In code you need to use True, not Yes, but that should be causing a
different error (variable not defined) so there may be something else wrong
as well. But try changing that, and double check that the check box is
called 'Inter Depot Transport'. Also, don't forget to turn the Visible
property back on when the value of the check box changes. Here's an example
....

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If TestBool = False Then
TestText.Visible = False
Else
TestText.Visible = True
End If

End Sub


--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


JohnC said:
My label and check are both in the detail section of the report. I've
tried
this code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If [Inter Depot Transport] = Yes Then
Label32.Visible = False
End If

End Sub

I get the error message "You have entered an expression with no value",
please excuse my ignorance. Can you see the problem?

Brendan Reynolds said:
Use the Format event of the report Section that contains the controls.
Sections include the Report Header and Footer sections, the Page Header
and
Footer sections, the Detail section, and if you have added them, one or
more
Group Header and Footer sections. Your label and check box are *probably*
in
the Detail section, but without seeing your report I can't be sure.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible
for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Thank you very much, Using your code and checking the details as you
suggested has done the trick. Much appreciated.

Brendan Reynolds said:
In code you need to use True, not Yes, but that should be causing a
different error (variable not defined) so there may be something else wrong
as well. But try changing that, and double check that the check box is
called 'Inter Depot Transport'. Also, don't forget to turn the Visible
property back on when the value of the check box changes. Here's an example
....

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If TestBool = False Then
TestText.Visible = False
Else
TestText.Visible = True
End If

End Sub


--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


JohnC said:
My label and check are both in the detail section of the report. I've
tried
this code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If [Inter Depot Transport] = Yes Then
Label32.Visible = False
End If

End Sub

I get the error message "You have entered an expression with no value",
please excuse my ignorance. Can you see the problem?

Brendan Reynolds said:
Use the Format event of the report Section that contains the controls.
Sections include the Report Header and Footer sections, the Page Header
and
Footer sections, the Detail section, and if you have added them, one or
more
Group Header and Footer sections. Your label and check box are *probably*
in
the Detail section, but without seeing your report I can't be sure.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible
for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Can any one help? I would like for a label (Label32) on a report to be
Invisible unless a check box = yes. Can I use an If statement on a
report?
Any ideas? Neither the Label or Check Box have any Event Properties,
please
help!!!
 
Back
Top