Here is my code to launch the preview of the report:
'On Error Resume Next
DoCmd.OpenReport "Report of PCADs Assigned To", acViewPreview
DoCmd.Close acForm, "Get Report of PCADs Assigned to", acSaveNo
DoCmd.SelectObject acReport, "Report of PCADs Assigned To"
Here are the events I have for the report itself:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim TodaysDate As Date
Dim DatePlusWeek As Date
'todays date is actually todays date -1 so we catch today also
TodaysDate = DateAdd("d", -1, Now())
TodaysDate = Format(TodaysDate, "Short Date")
'DatePlus week is actually a week and a day so we get the full week
DatePlusWeek = DateAdd("d", 8, Now())
DatePlusWeek = Format(DatePlusWeek, "Short Date")
If Me.Current_Status Like "*Closed*" Then
Me.txtOverdueStatus = "Closed"
ElseIf Me.Due_Date < TodaysDate Then
Me.txtOverdueStatus = "Overdue"
ElseIf Me.Due_Date < DatePlusWeek Then
Me.txtOverdueStatus = "Coming Due"
Me.txtOverdueStatus = "Due"
Private Sub Report_NoData(Cancel As Integer)
MsgBox "This report has no data"
Cancel = True
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Dim strRealName As String
Dim intComma As Integer
Dim intLeft As Integer
Dim intRight As Integer
Dim intLen As Integer
Dim strFirstName As String
Dim strLastName As String
strLastName = Left(strRealName, intLeft)
strFirstName = Right(strRealName, intRight)
Me.txtTitle = "Report of All PCADs assigned to " & strFirstName & " " & strLastName
I am stumped...
I have my printer status open when I click the print button and sometimes it spools and then disappears from the window and sometimes it doesn't even spool. It is not the printer's problem b/c I have other reports withing the application that work in the same manner and they print fine.