Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display some controls on Front page and hide them on others?

Status
Not open for further replies.

sudakov

Programmer
Jun 17, 2007
53
US
Hello everyone,
I have a report with approximatelly 100 records in Detail section (4 pages).
The requirement is to display 15 bottom controls on the Front page and hide 10 of them on the other pages showing only 5 bottom controls.

As my aprroach, I put all 15 controls on the Page Footer Section.
Then I use the code below:

Code:
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

If Me.Page = 1 Then
    Me.Control1.Visible = True
    Me.Control2.Visible = True
    .
    .
    .
    Me.Control10.Visible = True
Else
    Me.Control1.Visible = False
    Me.Control2.Visible = False
    .
    .
    .
    Me.Control10.Visible = False
End If

End Sub

The issue is that Page Footer Section takes one third of a page.
Therefore, one third of a page is blank on all other pages except the Front page.

Does anybody know how to display some of bottom controls on Front page and hide them on other pages without having the blank space?

Thank you.
sudakov.
 
Put code like you have and the controls in the detail section. Set the controls to can shrink as well as the section and see if that does what you want.... You might also have to make the controls short and rely on Can Grow to make the section big enough on the first page.
 
I think this is very difficult if not impossible unless the size of the detail section and all group sections are static so that you know based on your record source the last record on the first page. This would allow you to create a group footer after a specific number of records.

Duane
Hook'D on Access
MS Access MVP
 
Oops... yes a group section footer not the detail section.... But can grow and can shrink is the way to at least lessen the effect of multiple rows....

I think I have a better idea.... Use two subreports... one with the more controls and one with the less.... make them both really short and set the can grow property of each to true.... then conditionally set the visible property.... I'm not sure of the timing but it should work.

The cumbersome part will be making the control sources pull the data from then main report....
 
lameid,
I'm not sure what benefit two subreports would provide. They won't display page sections. Where would you place these in the main report? Page sections can't grow or shrink.

Duane
Hook'D on Access
MS Access MVP
 
They will have to go in a group section... hopefully that is easy based on the dataset.

The advantage to two subreports is that they can each grow appropriately big vs. leaving whitespace behind.
 
I'm still not sure how the controls could be displayed at the bottom of a page about where the page footer section would be located.

Maybe we should allow sudakov to provide some feedback....

Duane
Hook'D on Access
MS Access MVP
 
Hi Duane and Laimeid.
Thank you both.
Sorry for the late response.

Duane,
I am trying to figure out whether your suggestion can be applied.
Duane said:
I think this is very difficult if not impossible unless the size of the detail section and all group sections are static so that you know based on your record source the last record on the first page. This would allow you to create a group footer after a specific number of records.
The Detail section (Record Source) can have from 1 up to 400 records.
Unfortunatelly, there are many cases when the report has one page only (record count <30). It means a group footer will not be located at the bottom of the page.

I am still trying to figure out a solution.

sudakov
 
What duane is saying is that you may be able to define how many records can fit per page if all your sections have heights that don't change or the can grow and can shrink properties are false.


That being said you would need in your record source define which page you should be on and group on it... So based on your 30 records per page, a formula might be...

Code:
Page_Number: (Recordnumber \ 30 + 1)

Note the use of the backslash or integer division.

Get the Recordnumber expression is the tricky part...

There should be a post about that issue around these fora or someone might post it yet...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top