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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a fixed length "detail" section in a report?

Status
Not open for further replies.

cheapo

Programmer
Aug 19, 2003
16
ID
Hi,

I am having trouble making a report.
This particular report must be 1 page in length.
The format is the usual header-detail-footer.

I need to make a fixed position for header and footer at the top and bottom of the page respectivelly.
The details section occupies the middle of the page.. around 15cm.. the report can only contain a maximum of 15 entries in the details section.
(i.e. 1 cm for every entry)

When it has 15 entries it occupies all the 15cm of space in the details and when it's lesser(e.g. only 3 entries, it should only occupies the first 3 cm and leave the other 12cm of space blank... and the footer will still be at the bottom of the page.

Is it this possible to make such report?
Is there any special tricks?

TIA
 
Instead of using the section header and footer, use the page header and footer. Set up your margins in page setup to get your header and footer where you want them and then set your detail section to 1 cm and force it to not shrink and not grow. Base your report on a query and in the query properties set the top value to 15 -- this will limit the results to 15 records.

This way your page header and footer will always be fixed no matter how many records you have from 0 to 15. Because the query will only get a maximum of 15 records, you should only get the 1 page report.

Hope this helps. :)
 
I have in the past simply drawn a Line in the detail section, which I then made not visible. Then I put my date (i.e. the 15 items or 3 items) in a sub report laid over the top of the lines.

If you set the subreport properties to let it grow, but the detial section to not grow, the report will always be the same size.
 
I would remove all line controls from the detail section and use the Line method to draw them. The following code prints 18 lines but you should be able to modify it to meet your needs.

Private Sub Report_Page()
Dim intLineCount As Integer
Dim intLines As Integer
Dim intLineSpacing As Integer
Dim intTopMargin As Integer
Dim intYPos As Integer
intLines = 18
intTopMargin = 720 'half inch
intLineSpacing = Me.Detail.Height
For intLineCount = 1 To intLines
intYPos = (intLineCount * intLineSpacing) + _
intTopMargin
Me.Line (0, intYPos)- _
Step(Me.Width, 0)
Next
End Sub

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top