How To hide a subreport?
I found how to know if the subreport has no data
(Me.subreportname.Report.HasData)
what I didn't find is how to make the sub report unvisibile if it has no data.
I tried:
If Not Me.subreportname.Report.HasData then
Me.subreportname.Report.Visible = False
End If
but it gave me an error
11 13756
hi there you could use this - if subreportname then
-
subreportname.visible = true
-
else
-
subreportname.visible = false
-
end if
lee123
The first time you refer to the subreport you are referring to the report itself so you need the .Report
However, the second time you are referring to the subreport object so you don't use .Report
You also have to allow for the true event. -
If Me.subreportname.Report.HasData then
-
Me.subreportname.Visible = True
-
Else
-
Me.subreportname.Visible = False
-
End If
-
Thanks for your attention, the code was OK,
but still I have a problem, since my target was to save the space that the balnk subreport takes' and although the sub report was unvisible' still the page was with large blank space, in the palce that the subreports was supposed to sit.
Do you have any idea how to save the blank space?
Thanks.
Thanks for your attention, the code was OK,
but still I have a problem, since my target was to save the space that the balnk subreport takes' and although the sub report was unvisible' still the page was with large blank space, in the palce that the subreports was supposed to sit.
Do you have any idea how to save the blank space?
Thanks.
Hi, Daniel.
Try the following. - Set subreport control .CanGrow = Yes
- Reduce subreport control height to possible minimum
- Handle subreport.Report "On No Data" event
-
Private Sub Report_NoData(Cancel As Integer)
-
Cancel = True
-
End Sub
-
Thanks a lot, but didn't work.
As much as I understood from searching google, the
"ON NO DATA" event, does not fire in the subreport.
Thanks a lot, but didn't work.
As much as I understood from searching google, the
"ON NO DATA" event, does not fire in the subreport.
LOL. It is really so.
But it works without handling event.
At least in my test:
Several bound textboxes
Unbound label
Unbound checkbox
Did you shrink an empty report area having reduced subreport control height?
Hi,
what did you mean "But it works without handling event." ?
Hi,
what did you mean "But it works without handling event." ?
Screenshot in attachment.
Daniel is correct that you don't need an event to hide the subreport. Just make the height of the subreport zero in design view and set CanGrow=Yes and CanShrink=Yes in the properties of the sub report.
However, you must also set CanGrow=Yes and CanShrink=Yes for the Report section which contains the subreport (|Detail, Report Footer or whatever)
Thanks you all for your attention and time, It worked.
You are welcome.
Kind regards,
Fish
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Steve Edwards |
last post by:
I am trying to use an existing report as a subreport in another report. I
have the subreport added to the main report, but the only thing that shows
up where the subreport should be is the name of...
|
by: dixie |
last post by:
I have a report with a subreport. The source object for this subreport
varies according to the value of a field in a table. I am trying to
programmatically set the object source for the subreport...
|
by: Downstreamer |
last post by:
Design is as follows:
A form for the user to input criteria to be used as the where part of
the report's recordsource. This includes a multiselect list box as part
of the criteria selection.
...
|
by: Ellen Manning |
last post by:
I've got an A2K report showing students and their costs. Student info
is in the main report and costs are in a subreport for each student.
The user inputs the program desired then only those...
|
by: shaqattack1992-newsgroups |
last post by:
I know this is kind of a weird question, but is there anyway to give a
subreport control of a main report?
I posted my situation earlier about having drawings print out after a
group. I have a...
|
by: C |
last post by:
Hi,
I have a main Report which has a SubReport.
This SubReport also has a SubReport.
I set the data of my main Report and Subreport through code
DataSet dsMainReport =...
|
by: Simon |
last post by:
Dear reader,
The syntax for the VBA code to change the RowSource of a Master Report is:
Me.RowSource = "TableOrQueryName"
|
by: Simon |
last post by:
Dear reader,
The syntax for the VBA code to change the RecordSource of a Master Report
is:
Me.RecordSource = "TableOrQueryName"
|
by: tasawer |
last post by:
Hi,
When I print my report with subreport having no data, there is a big gap between the lines. How can I supress/hide subreport when it has no data.
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |