I have a database that i am try to loop through a table (maillist)of email address to send out different reports based on the field [deptid]. can you help
Dim project
project = Deptid
Do Until maillist.EOF
If project = 1 Then
DoCmd.SendObject acSendReport, "rptcalendar1", acFormatSNP, RP_email, , , "test", , False
ElseIf project = 2 Then
DoCmd.SendObject acSendReport, "rptcalendar2", acFormatSNP, RP_email, , , "test", , False
End If
maillist.MoveNext
Loop
Dim project
project = Deptid
Do Until maillist.EOF
If project = 1 Then
DoCmd.SendObject acSendReport, "rptcalendar1", acFormatSNP, RP_email, , , "test", , False
ElseIf project = 2 Then
DoCmd.SendObject acSendReport, "rptcalendar2", acFormatSNP, RP_email, , , "test", , False
End If
maillist.MoveNext
Loop