dhookom,
Does this help you out in figuring out my issue?
Option Explicit
'****************************************************************
'This function will walk through a table and email the
'report, which is filtered using
'MS Outlook through the MS Access SendObject.
'
'This function assumes the report has the default printer
'set to PDF.
'****************************************************************
Public strInvoiceWhere As String
Function AJSendStaffingReport()
Dim headcounts As DAO.Database
'set table containing data source?
Dim Staffing_Report_ALL_NEW_BREAKS As DAO.Recordset
Set headcounts = Currentdb()
Set Staffing_Report_ALL_NEW_BREAKS = headcounts.OpenRecordset("Staffing_Report_ALL_NEW_BREAKS", _
dbOpenDynaset)
'If MsgBox("Do you want to create report" & Chr(13) & _ <put prompt back in later
' "to all receiptents using Microsoft Outlook?", 4) = 6 Then
With Staffing_Report_ALL_NEW_BREAKS
Do Until .EOF
'Create the report Filter <-how to replace in query
'used by the Report_Open event. <-how to replace report_open to define variable
strInvoiceWhere = "[hierarchy_code] = '" & ![hierarchy_code] & "'"
DoCmd.SetWarnings False
DoCmd.OpenQuery "Staffing_Report_ALL_NEW"
DoCmd.SetWarnings True
' create report as pdf with unique filename
'SendKeys "c:\z\Staffing_Report_" & ![hierarchy_code] & "_" & ![rvp_avp_last_name] & "_" & Format(Now(), "YYYYMMDD") & "~^sy", False
'DoCmd.OpenReport "_Staffing Report - COMBINED - Consolidated", acViewNormal, "", "", acHidden
' then attach both files and send
' DoCmd.SendObject acReport, "_Staffing Report - COMBINED - Consolidated", acFormatRTF, _
' ![test], , , "Weekly Open Requisition Report - " & Format(Now(), "mm/dd/yy"), ![hierarchy_name] & " THIS IS A TEST open requisition report attached - ARE YOU HAPPY???", False
.MoveNext
Loop
End With
' End If < remove comment later when prompt is put back in
Staffing_Report_ALL_NEW_BREAKS.Close ' close break list
'DONE with hierarchy pass