Exodus
Registered User.
- Local time
- Today, 06:17
- Joined
- Dec 4, 2003
- Messages
- 317
I want to print the first and last records per page of a report.
Took the code from the Solutions Db. and change the nessary names.
I'm getting Type error. How do I fix this. The field I want to show is a number field.
Option Compare Database ' Use database order for string comparisons.
Option Explicit
' Array for last record on each page and last record in recordset.
Dim gLast() As String
' Flag for number of passes through report.
Dim gLastPage As Integer
Private Sub PageFooter2_Format(Cancel As Integer, FormatCount As Integer)
' During first pass, increase size of array
' and enter last record on page into array.
If Not gLastPage Then
ReDim Preserve gLast(Reports!inventory.Page + 1)
gLast(Reports!inventory.Page) = _
Reports!inventory!SerialNumber
End If
End Sub
Private Sub PageHeader0_Format(Cancel As Integer, FormatCount As Integer)
' During second pass, fill in FirstEntry
' and LastEntry text boxes.
If gLastPage = True Then
Reports!inventory!FirstEntry = _
Reports!inventory!SerialNumber
Reports!inventory!LastEntry = _
gLast(Reports!inventory.Page)
End If
End Sub
Private Sub ReportFooter4_Format(Cancel As Integer, FormatCount As Integer)
Dim dbs As Database
Dim rst As Recordset
' Set flag after first pass has been completed.
gLastPage = True
' Open recordset for report.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("CardActivators")
' Move to last record in recordset.
rst.MoveLast
' Enter last record into array.
ReDim Preserve gLast(Reports!inventory.Page + 1)
gLast(Reports!inventory.Page) = rst!SerialNumber
End Sub
Took the code from the Solutions Db. and change the nessary names.
I'm getting Type error. How do I fix this. The field I want to show is a number field.
Option Compare Database ' Use database order for string comparisons.
Option Explicit
' Array for last record on each page and last record in recordset.
Dim gLast() As String
' Flag for number of passes through report.
Dim gLastPage As Integer
Private Sub PageFooter2_Format(Cancel As Integer, FormatCount As Integer)
' During first pass, increase size of array
' and enter last record on page into array.
If Not gLastPage Then
ReDim Preserve gLast(Reports!inventory.Page + 1)
gLast(Reports!inventory.Page) = _
Reports!inventory!SerialNumber
End If
End Sub
Private Sub PageHeader0_Format(Cancel As Integer, FormatCount As Integer)
' During second pass, fill in FirstEntry
' and LastEntry text boxes.
If gLastPage = True Then
Reports!inventory!FirstEntry = _
Reports!inventory!SerialNumber
Reports!inventory!LastEntry = _
gLast(Reports!inventory.Page)
End If
End Sub
Private Sub ReportFooter4_Format(Cancel As Integer, FormatCount As Integer)
Dim dbs As Database
Dim rst As Recordset
' Set flag after first pass has been completed.
gLastPage = True
' Open recordset for report.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("CardActivators")
' Move to last record in recordset.
rst.MoveLast
' Enter last record into array.
ReDim Preserve gLast(Reports!inventory.Page + 1)
gLast(Reports!inventory.Page) = rst!SerialNumber
End Sub