If IsNull(strReport) Then
MsgBox "Please select a report.", vbOKOnly
Me.lstReports.SetFocus
Exit Sub
Else
Select Case Me.fraOutputTo
Case 1 'Preview
DoCmd.OpenReport strReport, acViewPreview
Case 2 'Print
DoCmd.OpenReport strReport, acViewNormal
Case 3 'Export to PDF
If Me.txtPath & "" = "" Then
MsgBox "Please select a path.", vbOKOnly
Me.cmdBrowse.SetFocus
Exit Sub
End If
strFileName = Me.txtPath & "\" & Me.cboJob.Column(1) & "_" & strReport & "_" & Format(Date, "yyyymmdd") & ".pdf"
DoCmd.OutputTo acOutputReport, strReport, acFormatPDF, strFileName
Case 4 'Export to Excel
If Me.txtPath & "" = "" Then
MsgBox "Please select a path.", vbOKOnly
Me.cmdBrowse.SetFocus
Exit Sub
End If
strFileName = Me.txtPath & "\" & Me.cboJob.Column(4) & "_" & Me.txtExcelQueryName & "_" & Me.cboJob.Column(1) & "_" & Format(Date, "yyyymmdd") & ".xls"
Kill strFileName
If Me.lstReports.Column(3) = "P-01" Then 'Weekly Job Status
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, Me.txtExcelQueryName, strFileName, False
Call FormatWeeklyJobStatus(strFileName)
Else
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, Me.txtExcelQueryName, strFileName, True
End If
MsgBox "Export Complete - File name = " & strFileName
End Select
End If