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

How to Populate the detail section of a report with line numbers 1

Status
Not open for further replies.

kb9prt

Technical User
Dec 8, 2003
14
US
Hello - I'm relatively new at this so please talk to me as if I am a three year old.

I have a report with a page header, detail section, and a page footer. The detail section populates from a query with a sample identification (sample name). There can be a variety of samples for each report. The report works just fine except that I had a complaint that when there are only 1 or 2 samples, the page is blank until the page footer. It was thought that this looked unprofessional. Anyway….. I would like the page to continue to print what amounts to blank boxes with a line number until the end of a page. Each page displays up to 25 samples. I have a text box with a control source of =1. This prints a line number as long as there is a sample. I would like it to continue until the end of the page.

I would appreciate any suggestions. If I have not explained well enough I would be happy to answer questions.

Thanks

KB9PRT


 
If I am following correctly...

Set that textbox Running Sum = Over All

Dave
 
I would remove any =1 text box and print all line number and possibly lines with code in the On Page event of the report:


Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)-Step(Me.Width, 0)
Next
End Sub

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thanks for the quick reply.

This is what I was looking for, although it prints line numbers acrossed the header section of the report. I would like the line numbers in the detailed section only. I am sure that with a little adjustment I will be able to work it out.

You have been most helpful.
Thank you
 
Set the value for intTopMargin to what you need.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
The original idea worked fine but now there is an additional request. I would like to print out the Detail section of the report a multiple of 25 regardless of how many records are pulled into it. Let me try to explain further. If the report only has 5 records to print I would like it to print the detail section of the report a total of 25 times including the 5 rows that contain the records. I thought printing a line would be sufficient but it was not. Is there a way to force the detail section to print a specified number of times before a page break, leaving a text box empty if there are no records to group? The Row is a Text box grouped on sample ID and then a series of boxes. Any help would be appreciated
 
I'm not sure what you need. The code I provided prints 24 lines regardless of the number of records.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Dhookom -

The solution that you provided worked great! - I was able to match up the line with the current record and it printed 25 lines regardless of how many records were grouped. I was just wondering if there was a way to print the detailed section within the "On Page" macro a specified number of times regardless of how many records were grouped. We changed the line format from a line to a cell (rectangle boxs acrossed the row) and I thought that it would be easier to force the detail section to run 25 times per page than it would be to match all the cells acrossed the row to the page header.

I appreciate your all your help

Fred

 
I don't think there is a method of printing "ghost" records. I could probably figure out a method using right joins in a cartesian query but it would be much more work than it is worth (for me).

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
That's what I needed to know. I wanted to make sure I was not missing something simple - like so often is the case.

thanks for all your help. This Forum rocks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top