Solved

set label visible false in main report from sub report

Posted on 2008-10-01
6
805 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

809 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