Send Email GoTo Next Record if NOT EOF

  • Thread starter LillianH via AccessMonster.com
  • Start date
L

LillianH via AccessMonster.com

Attached below is code for the user to answer YesNo to two questions. If
they answer Yes they want to send email it should send the email. After
answering the second question No, then should go to next record if NOT EOF.
After answering yes to send the email, then should go to the next record if
NOT EOF. IF EOF then close the form. Instead I get an error msg and the
system freezes if the user answers yes to send an email. See Code Below.


Private Sub cmdbRevCmplt_Click()
On Error GoTo cmdbRevCmplt_Err

Dim intResponse As Integer
Dim intResponseContinue As String
Dim strPrompt As String
Dim strPromptContinue As String
Dim strMgrEmail As String
Dim clsSendObject As accSendObject



strPrompt = "Have you submitted ALL errors or Passed all Sections?"
strPromptContinue = "Would you like to send an email for this review?"
intResponse = MsgBox(strPrompt, vbYesNo)
intResponseContinue = MsgBox(strPromptContinue, vbYesNo)

strMgrEmail = Me.txtMgrEmail & ""

If intResponse = vbYes Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryReviewComplete"
DoCmd.OpenQuery "qryAppendErrors_d", acViewNormal, acEdit
DoCmd.SetWarnings (WarningsOff)
Me![cmbxChkLst] = Null
End If
If intResponse = vbNo Then
Me![cmbxChkLst].SetFocus
End If


If intResponseContinue = vbYes Then

DoCmd.OpenReport "rptQAReview", acViewPreview, "", "", acHidden
Set clsSendObject = New accSendObject

clsSendObject.SendObject acSendReport, "rptQAReview", accOutputSNP, ,
strMgrEmail, , "FROM QA: Additional processing may be required on " & Me.
TxtContract, "A " & Me![WorkType] & " was processed by " & Me!
[TxtAnalystName] & " on " & Me![Log_Date] & vbCrLf & vbCrLf & vbCrLf _
& "The transaction may require additional processing." & vbCrLf & _
"Please see the attached QA review for detail of errors and comments.
" & vbCrLf & vbCrLf & vbCrLf & vbCrLf & _
"Thank You", True
Set clsSendObject = Nothing
DoCmd.Close acReport, "rptQAReview", acSaveNo
DoCmd.GoToRecord , , "frmQAReview", acNext

End If

If intResponseCancel = vbNo Then
DoCmd.GoToRecord , , acNext
End If


Exit_cmdbRevCmplt_Click:
'DoCmd.Close
Exit Sub

cmdbRevCmplt_Err:
DoCmd.GoToRecord , , "frmQAReview", acNext
Resume Exit_cmdbRevCmplt_Click


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top