Solved

set label visible false in main report from sub report

Posted on 2008-10-01
6
786 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
Comment Utility
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
Comment Utility
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
Comment Utility
You must use the name of the subform container control as it it seen on the main form.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:DCRAPACCESS
Comment Utility
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
Comment Utility
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
Comment Utility
thank you, that was the thing I needed :-)
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now