Good morning,
I have this procedure that is run that pulls email names that match our
global database and emails reports to automatically to each group of names,
using click yes and Outlook. I have created a trap, error handler that skips
the cost center that has an invalid name it. My question is, if the field
has four names in it and only one of them is invalid, how can I still send to
the three that are good and skip the one that is invalid?
here is the code I am using:
Sub EMail_BranchPip eline()
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim qdf As QueryDef
Dim BRANCH As String
Dim BranchName As String
Dim BREml As String
Dim stDocName As String
Dim varme As Variant
Set dbs = CurrentDb()
Set rst = dbs.OpenRecords et("qryPIPWEmai lList")
Let stDocName = "rptPIPWDetailP ipeline"
rst.MoveFirst
DoCmd.SetWarnin gs False
DoCmd.OpenForm ("frmPIPWReport Gen")
Do Until rst.EOF
Let BRANCH = rst!Branch5dgt
Let BranchName = rst![Branch Name]
Let BREml = rst!PipelineEma il
Let [Forms]![frmPIPWReportGe n]![BrName].Value = BranchName
Let [Forms]![frmPIPWReportGe n]![BRANCH].Value = BRANCH
varme = DCount("[Loan #]", "qryPIPWDetailP ipeline")
If (varme <> 0 And [Forms]![frmBPProdRepDat eInput]![Check22] = False)
Then DoCmd.OpenRepor t stDocName, acViewNormal
On Error GoTo ErrorHandler
If (varme <> 0 And [Forms]![frmBPProdRepDat eInput]![Check19] = False)
Then DoCmd.SendObjec t acSendReport, stDocName, acFormatSNP, BREml, , ,
BranchName & " Pipeline Reports", "Pipeline report for " & BranchName & "
attached. This is a multiple page report, please make sure you view or print
all pages.", False
rst.MoveNext
Loop
rst.Close
Set dbs = Nothing
DoCmd.Close acForm, ("frmPIPWReport Gen")
DoCmd.SetWarnin gs True
ErrorHandler:
If Err.Number = 2295 Then
MsgBox "Error number " & Err.Number & ": " & Err.Description + " For
Cost Center " + [Forms]![frmCMSHReportGe n]![CstCntr]
Resume Next
End If
End Sub
--
Message posted via AccessMonster.c om
I have this procedure that is run that pulls email names that match our
global database and emails reports to automatically to each group of names,
using click yes and Outlook. I have created a trap, error handler that skips
the cost center that has an invalid name it. My question is, if the field
has four names in it and only one of them is invalid, how can I still send to
the three that are good and skip the one that is invalid?
here is the code I am using:
Sub EMail_BranchPip eline()
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim qdf As QueryDef
Dim BRANCH As String
Dim BranchName As String
Dim BREml As String
Dim stDocName As String
Dim varme As Variant
Set dbs = CurrentDb()
Set rst = dbs.OpenRecords et("qryPIPWEmai lList")
Let stDocName = "rptPIPWDetailP ipeline"
rst.MoveFirst
DoCmd.SetWarnin gs False
DoCmd.OpenForm ("frmPIPWReport Gen")
Do Until rst.EOF
Let BRANCH = rst!Branch5dgt
Let BranchName = rst![Branch Name]
Let BREml = rst!PipelineEma il
Let [Forms]![frmPIPWReportGe n]![BrName].Value = BranchName
Let [Forms]![frmPIPWReportGe n]![BRANCH].Value = BRANCH
varme = DCount("[Loan #]", "qryPIPWDetailP ipeline")
If (varme <> 0 And [Forms]![frmBPProdRepDat eInput]![Check22] = False)
Then DoCmd.OpenRepor t stDocName, acViewNormal
On Error GoTo ErrorHandler
If (varme <> 0 And [Forms]![frmBPProdRepDat eInput]![Check19] = False)
Then DoCmd.SendObjec t acSendReport, stDocName, acFormatSNP, BREml, , ,
BranchName & " Pipeline Reports", "Pipeline report for " & BranchName & "
attached. This is a multiple page report, please make sure you view or print
all pages.", False
rst.MoveNext
Loop
rst.Close
Set dbs = Nothing
DoCmd.Close acForm, ("frmPIPWReport Gen")
DoCmd.SetWarnin gs True
ErrorHandler:
If Err.Number = 2295 Then
MsgBox "Error number " & Err.Number & ": " & Err.Description + " For
Cost Center " + [Forms]![frmCMSHReportGe n]![CstCntr]
Resume Next
End If
End Sub
--
Message posted via AccessMonster.c om
Comment