I have a report that prints over 200 pages. I want to warn the user in a simple message before the report prints. In the following procedure the message states 0 pages even though when I step through the code the variable holds 266. What have I done wrong?
Private Sub PrintForms_Click()
Dim rst As DAO.Recordset, RCount As Integer
Dim strMessage As String
Dim bytChoice As Byte
On Error GoTo PrintForms_Click_Error
strMessage = “You are about to print ” & RCount & ” pages.”
Set rst = CurrentDb.TableDefs(“tbl_ANNUAL_REVIEWS_1”).OpenRecordset
RCount = rst.RecordCount
rst.MoveLast
bytChoice = MsgBox(strMessage, vbInformation + vbOKCancel, conAppName2)
If bytChoice = vbOK Then
OpenReports (“rpt_REPORTS_ALL”)
ElseIf bytChoice = vbCancel Then
DoCmd.CancelEvent
End If
rst.Close
Set rst = Nothing
On Error GoTo 0
Exit Sub
PrintForms_Click_Error:
MsgBox “Error ” & Err.Number & ” (” & Err.Description & “) in procedure PrintForms”
End Sub