(1) If I cancel the process (recordset cycle) after the first one or two reports are sent (no problem); however, if I cancel later in the process, the database locks up. (2) I cannot update a field [Remarks] while cycling through the records.
On Error GoTo Err_Image635_Click
Dim db As DAO.Database
Dim rs As Object
Set rs = CurrentDb.OpenRecordset("SELECT * FROM qry91To120DaysFromPDDEmail")
If Not rs.EOF Then
rs.MoveFirst
Do
DoCmd.OpenReport "rptPrintOneRecord120DayAlert", acViewPreview, , "ReloID = " & rs!ReloID, acHidden
DoCmd.SendObject acSendReport, "rptPrintOneRecord120DayAlert", acFormatPDF, blah, blah, True
DoCmd.Close acReport, "rptPrintOneRecord120DayAlert", acSaveNo
Me.Remarks = "Test"
'Me.Remarks = Me.Remarks & vbCrLf & Format(Now, "dd mmm yy") & ": " & Nz([Grade]) & " " & Nz([Last Name]) & " was reminded this date to provide us the necessary documents so we could generate PCS orders"
rs.MoveNext
Loop While Not rs.EOF
End If
Exit_SendReports_Click:
Exit Sub
Exit_Image635_Click:
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_Image635_Click:
MsgBox Err.Description
Resume Exit_Image635_Click
On Error GoTo Err_Image635_Click
Dim db As DAO.Database
Dim rs As Object
Set rs = CurrentDb.OpenRecordset("SELECT * FROM qry91To120DaysFromPDDEmail")
If Not rs.EOF Then
rs.MoveFirst
Do
DoCmd.OpenReport "rptPrintOneRecord120DayAlert", acViewPreview, , "ReloID = " & rs!ReloID, acHidden
DoCmd.SendObject acSendReport, "rptPrintOneRecord120DayAlert", acFormatPDF, blah, blah, True
DoCmd.Close acReport, "rptPrintOneRecord120DayAlert", acSaveNo
Me.Remarks = "Test"
'Me.Remarks = Me.Remarks & vbCrLf & Format(Now, "dd mmm yy") & ": " & Nz([Grade]) & " " & Nz([Last Name]) & " was reminded this date to provide us the necessary documents so we could generate PCS orders"
rs.MoveNext
Loop While Not rs.EOF
End If
Exit_SendReports_Click:
Exit Sub
Exit_Image635_Click:
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_Image635_Click:
MsgBox Err.Description
Resume Exit_Image635_Click