• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 840
  • Last Modified:

set label visible false in main report from sub report

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
DCRAPACCESS
Asked:
DCRAPACCESS
  • 3
  • 3
1 Solution
 
peter57rCommented:
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
 
DCRAPACCESSAuthor Commented:
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
 
peter57rCommented:
You must use the name of the subform container control as it it seen on the main form.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
DCRAPACCESSAuthor Commented:
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
 
peter57rCommented:
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
 
DCRAPACCESSAuthor Commented:
thank you, that was the thing I needed :-)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now