Solved

set label visible false in main report from sub report

Posted on 2008-10-01
6
825 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

691 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