Solved

set label visible false in main report from sub report

Posted on 2008-10-01
6
820 Views
Last Modified: 2013-11-05
Hi Experts

Can someone tell how I change the visibility of a label in the main report, if there are no data in a subreport?
 
0
Comment
Question by:DCRAPACCESS
  • 3
  • 3
6 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 22612201
In the form_Curent event procedure for the main form..

If Me.subformname.Form.RecordsetClone.RecordCount = 0 Then
me.labelname.visible = false
else
me.labelname.visible = true
end if
0
 

Author Comment

by:DCRAPACCESS
ID: 22612302
the autofinish don't show the .RecordCount option. and i get and error message saying "you entered an expression that has an invalid reference to the property From/report"

should i you the real name of the subreport or the name it has been giving in the main report?
real name "Urpt_Benchmark_oversigt_Mifid" or name in main report "subBenchmark"

If Me.subBenchmark.Form.RecordsetClone.RecordCount = 0 Then
Me.Label114.Visible = False
Me.Label121.Visible = False
Else
Me.Label114.Visible = True
Me.Label121.Visible = True
End If

0
 
LVL 77

Expert Comment

by:peter57r
ID: 22612329
You must use the name of the subform container control as it it seen on the main form.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:DCRAPACCESS
ID: 22612353
yes, i have done that but still i get the error :-(

i have set the code in the "Report_Open" sub.

Should it be set elsewhere?
0
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 22612404
Very Sorry -  I have completely misread the Q and have given you an answer for sub- Forms not sub-reports.

For subreports there is a Hasdata property which can be used.

You use the Format event for whichever sectioncontains the label you want to suppress:
Example:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Me.subProducts.Report.HasData Then
Me.SupplierID_Label.Visible = True
Else
Me.SupplierID_Label.Visible = False
End If

End Sub

0
 

Author Comment

by:DCRAPACCESS
ID: 22612498
thank you, that was the thing I needed :-)
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question