Problem with Report code

T

Tony Williams

Here is my code
Private Sub Report_Activate()
If Me![rptCReDriving Licence].Report.Recordset.RecordCount = 0 Then
Me.lblnoinfo.Visible = False
Else
Me.lblnoinfo.Visible = True
End If
Me.Refresh
End Sub
I have a main report with a number of subreports. in the above example if
the rptCREDriving Licence has no data I want lblnoinfo (which is an unbound
label) to appear in its place. However it doesn't work. can anyone see why?
Thanks
Tony
 
G

Guest

Try
Me.lblnoinfo.Visible = Not Me.[rptCReDriving Licence].Report.HasData

You might also want to can the code and use a text box rather than label.
Set the control source to:
=IIf([rptCReDriving Licence].Report.HasData, Null,"Former Label Caption")
 
T

Tony Williams

Hi Duane tried your second suggestion and got a prompt box for the name of
the report and Access changed the control source to this
=IIf([rptCReDriving Licence].[Report].[HasData],Null,"Former Label Caption")

Notice the extra square brackets that have appeared???

Any ideas?
Thanks
Tony
Duane Hookom said:
Try
Me.lblnoinfo.Visible = Not Me.[rptCReDriving Licence].Report.HasData

You might also want to can the code and use a text box rather than label.
Set the control source to:
=IIf([rptCReDriving Licence].Report.HasData, Null,"Former Label Caption")


--
Duane Hookom
Microsoft Access MVP


Tony Williams said:
Here is my code
Private Sub Report_Activate()
If Me![rptCReDriving Licence].Report.Recordset.RecordCount = 0 Then
Me.lblnoinfo.Visible = False
Else
Me.lblnoinfo.Visible = True
End If
Me.Refresh
End Sub
I have a main report with a number of subreports. in the above example if
the rptCREDriving Licence has no data I want lblnoinfo (which is an
unbound
label) to appear in its place. However it doesn't work. can anyone see
why?
Thanks
Tony
 
G

Guest

Confirm the name of the report control. Is the textbox in the same section of
the report as the subreport?

--
Duane Hookom
Microsoft Access MVP


Tony Williams said:
Hi Duane tried your second suggestion and got a prompt box for the name of
the report and Access changed the control source to this
=IIf([rptCReDriving Licence].[Report].[HasData],Null,"Former Label Caption")

Notice the extra square brackets that have appeared???

Any ideas?
Thanks
Tony
Duane Hookom said:
Try
Me.lblnoinfo.Visible = Not Me.[rptCReDriving Licence].Report.HasData

You might also want to can the code and use a text box rather than label.
Set the control source to:
=IIf([rptCReDriving Licence].Report.HasData, Null,"Former Label Caption")


--
Duane Hookom
Microsoft Access MVP


Tony Williams said:
Here is my code
Private Sub Report_Activate()
If Me![rptCReDriving Licence].Report.Recordset.RecordCount = 0 Then
Me.lblnoinfo.Visible = False
Else
Me.lblnoinfo.Visible = True
End If
Me.Refresh
End Sub
I have a main report with a number of subreports. in the above example if
the rptCREDriving Licence has no data I want lblnoinfo (which is an
unbound
label) to appear in its place. However it doesn't work. can anyone see
why?
Thanks
Tony
 
T

Tony Williams

Thanks Duane. An incorrect name reference. I'd changed the name of the
report but didn't change the name of the subreport to match. Is it senility
or does everyone stare at something for a whole day and not notice the
obvious?
Thanks again Sorry for posting a question when the answer was right under my
nose!
Tony
Duane Hookom said:
Confirm the name of the report control. Is the textbox in the same section
of
the report as the subreport?

--
Duane Hookom
Microsoft Access MVP


Tony Williams said:
Hi Duane tried your second suggestion and got a prompt box for the name
of
the report and Access changed the control source to this
=IIf([rptCReDriving Licence].[Report].[HasData],Null,"Former Label
Caption")

Notice the extra square brackets that have appeared???

Any ideas?
Thanks
Tony
Duane Hookom said:
Try
Me.lblnoinfo.Visible = Not Me.[rptCReDriving Licence].Report.HasData

You might also want to can the code and use a text box rather than
label.
Set the control source to:
=IIf([rptCReDriving Licence].Report.HasData, Null,"Former Label
Caption")


--
Duane Hookom
Microsoft Access MVP


:

Here is my code
Private Sub Report_Activate()
If Me![rptCReDriving Licence].Report.Recordset.RecordCount = 0 Then
Me.lblnoinfo.Visible = False
Else
Me.lblnoinfo.Visible = True
End If
Me.Refresh
End Sub
I have a main report with a number of subreports. in the above example
if
the rptCREDriving Licence has no data I want lblnoinfo (which is an
unbound
label) to appear in its place. However it doesn't work. can anyone see
why?
Thanks
Tony
 
G

Guest

It's Friday before a long weekend (at least here in the States) so you are
granted one such episode. You have now used yours up ;-)

--
Duane Hookom
Microsoft Access MVP


Tony Williams said:
Thanks Duane. An incorrect name reference. I'd changed the name of the
report but didn't change the name of the subreport to match. Is it senility
or does everyone stare at something for a whole day and not notice the
obvious?
Thanks again Sorry for posting a question when the answer was right under my
nose!
Tony
Duane Hookom said:
Confirm the name of the report control. Is the textbox in the same section
of
the report as the subreport?

--
Duane Hookom
Microsoft Access MVP


Tony Williams said:
Hi Duane tried your second suggestion and got a prompt box for the name
of
the report and Access changed the control source to this
=IIf([rptCReDriving Licence].[Report].[HasData],Null,"Former Label
Caption")

Notice the extra square brackets that have appeared???

Any ideas?
Thanks
Tony
Try
Me.lblnoinfo.Visible = Not Me.[rptCReDriving Licence].Report.HasData

You might also want to can the code and use a text box rather than
label.
Set the control source to:
=IIf([rptCReDriving Licence].Report.HasData, Null,"Former Label
Caption")


--
Duane Hookom
Microsoft Access MVP


:

Here is my code
Private Sub Report_Activate()
If Me![rptCReDriving Licence].Report.Recordset.RecordCount = 0 Then
Me.lblnoinfo.Visible = False
Else
Me.lblnoinfo.Visible = True
End If
Me.Refresh
End Sub
I have a main report with a number of subreports. in the above example
if
the rptCREDriving Licence has no data I want lblnoinfo (which is an
unbound
label) to appear in its place. However it doesn't work. can anyone see
why?
Thanks
Tony
 
T

Tony Williams

"Long weekend"? I dream of those and I'm supposed to be retired!!!!
Regards
Tony
Duane Hookom said:
It's Friday before a long weekend (at least here in the States) so you are
granted one such episode. You have now used yours up ;-)

--
Duane Hookom
Microsoft Access MVP


Tony Williams said:
Thanks Duane. An incorrect name reference. I'd changed the name of the
report but didn't change the name of the subreport to match. Is it
senility
or does everyone stare at something for a whole day and not notice the
obvious?
Thanks again Sorry for posting a question when the answer was right under
my
nose!
Tony
Duane Hookom said:
Confirm the name of the report control. Is the textbox in the same
section
of
the report as the subreport?

--
Duane Hookom
Microsoft Access MVP


:

Hi Duane tried your second suggestion and got a prompt box for the
name
of
the report and Access changed the control source to this
=IIf([rptCReDriving Licence].[Report].[HasData],Null,"Former Label
Caption")

Notice the extra square brackets that have appeared???

Any ideas?
Thanks
Tony
Try
Me.lblnoinfo.Visible = Not Me.[rptCReDriving Licence].Report.HasData

You might also want to can the code and use a text box rather than
label.
Set the control source to:
=IIf([rptCReDriving Licence].Report.HasData, Null,"Former Label
Caption")


--
Duane Hookom
Microsoft Access MVP


:

Here is my code
Private Sub Report_Activate()
If Me![rptCReDriving Licence].Report.Recordset.RecordCount = 0
Then
Me.lblnoinfo.Visible = False
Else
Me.lblnoinfo.Visible = True
End If
Me.Refresh
End Sub
I have a main report with a number of subreports. in the above
example
if
the rptCREDriving Licence has no data I want lblnoinfo (which is an
unbound
label) to appear in its place. However it doesn't work. can anyone
see
why?
Thanks
Tony
 

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