Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.
Private Sub Command25_Click() On Error GoTo Err_Command25_Click Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim strSQL As String Dim lngBookingID As Long Dim strEmail As String strSQL = "SELECT BookingID,StudentEmail From qryBookingIDAndStudentEmail" Set dbs = CurrentDb() Set rst = dbs.OpenRecordset(strSQL) rst.MoveFirst Do While Not rst.EOF lngBookingID = rst!BookingID strEmail = rst!StudentEmail DoCmd.SendObject acSendReport, "rptBookingConfirmationEmail", acFormatHTML, strEmail, , , "Confirmation of Needs Assessment Booking.", "Please find attached details of your pending appointment at CLASS", True rst.MoveNext Loop lngpubBookingID = 0 MsgBox "Done", vbInformation rst.Close Set rst = Nothing dbs.Close Set dbs = Nothing Exit_Command25_Click: On Error Resume Next rst.Close Set rst = Nothing dbs.Close Set dbs = Nothing Exit Sub Err_Command25_Click: If Err.Number = 2501 Then Resume Exit_Command25_Click Else MsgBox "There was an error sending the email" & vbCrLf & vbCrLf & Err.Number & ": " & vbCrLf & vbCrLf & Error, vbExclamation Resume Exit_Command25_Click End If End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.