Forum Discussion
PGregers
Sep 02, 2022Copper Contributor
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...
- Sep 02, 2022
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
arnel_gp
Sep 02, 2022Steel Contributor
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
- PGregersSep 02, 2022Copper ContributorYou are an absolute genius! Thanks so much, that works perfectly.
- Tom_van_StiphoutSep 02, 2022Steel ContributorYou can delete lines 7-9. They don't add anything. The test in line 10 suffices.