Forum Discussion

PGregers's avatar
PGregers
Copper Contributor
Sep 02, 2022

VBA Errors - SendObject

Hello   I'm a complete and total VBA novice. I'm trying to learn but it's making want to scream into a cushion. I would really appreciate some help.   I have a database all set up for student inf...
  • arnel_gp's avatar
    Sep 02, 2022

    PGregers 

    you may need to Open a Recordset (your student table) and loop through each record and send the email:

    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    
    Set db = CurrentDb
    Set rs = db.OpenRecordset("yourStudentTable")
    With rs
        If Not (.BOF And .EOF) Then
            .MoveFirst
        End If
        Do Until .EOF
            DoCmd.SendObject acSendReport, "ImmersionRFiltered", acFormatPDF, !Email & "", , , "IMPORTANT: Module 201 Immersion Week Timetable"
            .MoveNext
        Loop
        .Close
    End With
    Set rs = Nothing
    Set db = Nothing

Resources