Hello AccessWorld.
I found a post by arnelgp (AddBlankLinesInReport.accdb) that helped me add blank rows to complete a report. I was able to use the report when printing a single person's report. However, now I am now trying to use the same code but in a grouped report. I've tried but have failed miserably. Is it possible to apply the same code to a group report?
This is the code that arnelgp created.
I thought that maybe I would be able to combine it with this code that numbers pages in grouped reports but i get an error that i cant modify the report once created. I'm lost..
I found a post by arnelgp (AddBlankLinesInReport.accdb) that helped me add blank rows to complete a report. I was able to use the report when printing a single person's report. However, now I am now trying to use the same code but in a grouped report. I've tried but have failed miserably. Is it possible to apply the same code to a group report?
This is the code that arnelgp created.
Code:
Dim iFill As Integer
Dim total_records As Long
Dim sql As String
With CurrentDb.OpenRecordset(Me.RecordSource, dbOpenSnapshot)
If Not (.BOF And .EOF) Then
.MoveLast
.MoveFirst
End If
total_records = .RecordCount
End With
If total_records < MAX_LINES Then
iFill = MAX_LINES - total_records
ElseIf total_records > MAX_LINES Then
iFill = total_records Mod MAX_LINES
End If
sql = Trim$(Replace$(Me.RecordSource, ";", ""))
If InStr(1, sql, "SELECT") <> 1 Then
sql = "SELECT * FROM " & sql
End If
If iFill <> 0 Then
sql = sql & " UNION " & fnCreateDummyLineQuery(iFill, "OrderNumber", "StopNumber", "CustomerName", "PONumber", "ItemNumber", "ModelNumber")
Me.RecordSource = sql
End If
I thought that maybe I would be able to combine it with this code that numbers pages in grouped reports but i get an error that i cant modify the report once created. I'm lost..
Code:
Dim i As Integer
Dim dbs As Database
Set dbs = CurrentDb
If Me.Pages = 0 Then
ReDim Preserve GrpArrayPage(Me.Page + 1)
ReDim Preserve GrpArrayPages(Me.Page + 1)
GrpNameCurrent = HashID
'Debug.Print GrpNameCurrent
If GrpNameCurrent = GrpNamePrevious Then
GrpArrayPage(Me.Page) = GrpArrayPage(Me.Page - 1) + 1
GrpPages = GrpArrayPage(Me.Page)
For i = Me.Page - ((GrpPages) - 1) To Me.Page
GrpArrayPages(i) = GrpPages
Next i
Else
GrpPage = 1
GrpArrayPage(Me.Page) = GrpPage
GrpArrayPages(Me.Page) = GrpPage
End If
Else
ctlGrpPages = "Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent