Force ten rows

steve21nj

Registered User.
Local time
Today, 08:26
Joined
Sep 11, 2012
Messages
260
I have been working with the below code for a few days but havent been able to reach my desired results. The code forces horizontal lines, but wont put it in the detail section on print preview, only the page header.

I would like to force ten rows in the details section every time the report runs, even with zero records. I'd like the text box's format to show, meaning all the gridlines like that of an excel file to be intact.

In addition, i would be using a query to gather the information, and would like to force stop on the 10th record and continue a new page before adding additional records from the same id.

Any suggestions?

test1 is how the access report is displaying now.
test2 is how i would like the report to actually print.


Code:
Option Compare Database
Private Sub Report_Page()
Dim intNumLines As Integer
Dim intLineNumber As Integer
Dim intTopMargin As Integer
Dim ctl As Control
Dim intLineHeight As Integer
Dim intLineLeft As Integer
Dim intLineWidth As Integer
intNumLines = 10
intLineLeft = 350 '1/2 inch from left margin
intLineWidth = 1440 * 7.5 '5 inches
intTopMargin = Me.Section(0).Height 'details
intLineHeight = Me.Section(0).Height
Me.FontSize = 10
For intLineNumber = 0 To intNumLines - 1
Me.CurrentX = intLineLeft
Me.CurrentY = intTopMargin + _
(intLineNumber * intLineHeight)
Me.Print intLineNumber + 1
Me.Line (intLineLeft, intTopMargin + _
(intLineNumber * intLineHeight)) _
-Step(intLineWidth, 0)
Next
End Sub
 

Attachments

  • test1.PNG
    test1.PNG
    16.6 KB · Views: 137
  • test2.PNG
    test2.PNG
    9 KB · Views: 131
Thank you JHB... What happens when your query returns more values than what is on the list....

For example. I am doing an inventory of fuel for 50 cars. One car may have 2 transactions while another has 15. If I limit my temp table to 10, where would the additional 5 records go? How would i force those remaining 5 records to go to the next report, and then proceed with the next car?

Thank you.
 
Only a question, if a car have 15 transactions, then you also want 10 lines on the next page, (5 lines with data and 5 empty lines), and the start over again on a new page with next car?
Which data do you else want to show, and should it be shown at each page or only on the first page for each car?
Do you have some sample data?
 
Between a few queries, some coding, and a form...I was able to get the actual results I wanted, which in the end was 31 lines to display on the form. The query produces results up to 124 individual line items for a single vehicleID, just in case, even if the fuel entries for the vehicleid do not exist. So if the report had 66 entries for a vehicle, it would use 3 pages of the same report before moving to the next vehicle. If it had 3 entries, it would only use one page.

But then another monkey wrench was thrown in by my management...

The end query is the record source for my report title [M1] that displays fuel only.

Now they had me create another report [M2] that display non fuel information in which they want to run at the same time as [M1] and print in that order. That information is already captured in the query, but they want it displayed on another report.

[M2] uses the same record source as [M1]. The similarities on the reports are the VehicleID. The new report needs to be limited to 18 lines instead of the 31 lines of the other report.

How would I run M1 and M2 at the same time, running a duplex printer, to keep the records together?

If M1 vehicleId was 001, I would want M2 vehicleid 002 on the next available page, the back to M1 vehicleid 002 the M2 002 until end of file….

Is this even possible? I guess I am asking if you can collate the data using two separate reports?
 
Can't you put the new report (M2) as a sub report in the M1 report?
 
When I run the reports seperately, they work fine. When I add both reports to a new report as subreports, it will only print M1 and then a blank sheet. It isn't until all of M1's records are completed where it will run M2.

How can I have it collate where it prints record A001 on M1, then A001 on M2....I am attempting to print doing duplex printing as well.

I attached a sample document of how I would like the end results.

Also, do you have to link the two subreports together somehow? The main common aspect is the vehicleID.
 

Attachments

  • Duplex.PNG
    Duplex.PNG
    38.3 KB · Views: 113
As I see it, you should insert the M2 report in the M1 report as a sub report, (and not put both report in a new report).
The M1 and M2 should be link together by the vehicleID.
If you have some sample data then post it.
 

Users who are viewing this thread

Back
Top Bottom