error while Adding blank rows to a report (2 Viewers)

Murad

New member
Local time
Today, 18:10
Joined
Jan 13, 2021
Messages
6
I want to modify the sorting in the attached report.
When grouping is applied, empty rows appear at the top.
I would like this to be adjusted so they display correctly.

Thanks
 

Attachments

I can't get past
1766761278959.png

when opening report?
 
I want to modify the sorting in the attached report.
When grouping is applied, empty rows appear at the top.
I would like this to be adjusted so they display correctly.

Thanks
Why do you need the empty lines?
 
I want to modify the sorting in the attached report.
When grouping is applied, empty rows appear at the top.
I would like this to be adjusted so they display correctly.

Thanks
Help us understand the request by specifying the sort order you want to apply.
 
I want to modify the sorting in the attached report.
When grouping is applied, empty rows appear at the top.
I would like this to be adjusted so they display correctly.

Thanks
I Imported the database into a new database and then applied Descending Order
 

Attachments

Hi George
Ithink that is beyond my knowledge, but would appear pointless to me.
I'm partly guessing based on the use of the const in the VBA and the presence of the talley table. I've been wrong before, though.
 
I think the goal is to create 26 lines on the report per group, regardless of how many records are in each group.
My thoughts as well.
26 lines, regardless of how many real records.
Thought wouldn't that have to be done for each page?
O/P's example is just for 11 records. What if there are 27 records?
 
A couple issues.
1) your record source is a table name with no field names. Change the record source to qselYourTable with a SQL view of
Code:
SELECT YourTable.ID, YourTable.OrderNumber, YourTable.StopNumber, YourTable.CustomerName, YourTable.PONumber, YourTable.ItemNumber, YourTable.ModelNumber
FROM YourTable;
2) change the sorting and grouping to an expression using: =Nz([StopNumber],99999)
 
your record source is a table name with no field names.
I have that all the time. :unsure:
In the Open the O/P sets it to sql = "SELECT * FROM " and appends the table name, which is the recordsource to start with. ?
 
I don't believe you can create a union query with SQL like:
Code:
SELECT *
FROM Yourtable
UNION
SELECT A, B, C, D
FROM Yourtable
EDIT: I tried and this actually worked
Code:
SELECT yourTable.*
FROM yourTable
UNION
SELECT Null, Null, Null, Null, Null, Null,Null
FROM YourTable;
I also changed the name of the report to rptYourTable since duplicate names of an object in a database is never good practice.

The attached works for me and I believe matches the OP's request.
 

Attachments

Last edited:
That does give 26 records, blank or otherwise.
Now all the O/P needs to do is correct the logic for > MAX_LINES
 
you may also check this one.
i added another dummy table (dummy2).
using union query will fail if you have lot of stopNumber on your table and
the Union query will increase the the sql string and eventually will fail.
 

Attachments

Thanks everyone for the replies and for taking the time to look into this.
I appreciate all the input.
**

This is an Access report and grouping IS required.

Records are grouped normally and print in order.
What I need is a fixed page layout where each page always contains exactly 20 detail rows.

The behavior should be page-based, not group-based:
- Groups should flow naturally across pages.
- If a page ends with fewer than 20 records (for example, 15), the remaining rows on that same page should be blank.
- If the records (across groups) exceed 20, the report continues onto the next page and the same rule applies.
- Blank rows should never appear at the top of a page.
- Blank rows should never appear between records or between groups.
- Blank rows are only used to pad the bottom of each page to reach 20 rows.

The goal is consistent printing, not padding per group.
 
The behavior should be page-based, not group-based:
- Groups should flow naturally across pages.
- If a page ends with fewer than 20 records (for example, 15), the remaining rows on that same page should be blank.
- If the records (across groups) exceed 20, the report continues onto the next page and the same rule applies.
- Blank rows should never appear at the top of a page.
- Blank rows should never appear between records or between groups.
- Blank rows are only used to pad the bottom of each page to reach 20 rows.

The goal is consistent printing, not padding per group.

You don't need to return any blank rows. You can simply force a page break in the detail section after each 20th row. Firstly add a page break control to the bottom of the Detail section. Next declare a module level variable in the report's module's Declarations area. The following is from one of my own reports.

Code:
Dim intCounter As Integer

In the group header's Format event procedure initialise the variable:

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

    If FormatCount = 1 Then
        intCounter = 1
    End If
   
End Sub

In the detail section's Format event procedure increment the variable, and set the page break control's Visible property to True if the required number of rows is reached:

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

    If FormatCount = 1 Then
        intCounter = intCounter + 1
   
        If intCounter > 20 Then
            intCounter = 0
            Me.PageBreak.Visible = True
        Else
            Me.PageBreak.Visible = False
        End If
    End If
   
End Sub

Force a page break after the last row in the group by setting the group footer's ForceNewPage property to 'After Section'.
 
Last edited:
Still don’t need the counter, just the group footer's ForceNewPage property as suggested a number of posts back - if that creates more than the 20 or 26 rows required, just increase the height of the page footer
 
Still don’t need the counter, just the group footer's ForceNewPage property as suggested a number of posts back - if that creates more than the 20 or 26 rows required, just increase the height of the page footer

But what if some rows wrap to two or more lines?
 

Users who are viewing this thread

Back
Top Bottom