Returning Empty Reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the following to generate an email with the attached report, one
for each Director. The report is based on a query which has a date criteria
based on a textbox entry on frm_Email. It also has for criteria the entry
[Forms]![frm_Email].[Combo29] in the appropriate field. The results attach
the appropriate report to an e-mail to the matching director.

This loops through for every Director which sends some an empty report if
they had no entries on a certain date requested. How can I resolve the empty
report problem?

My frm_Email has a record source of tbl_DirectorsList so switching to a
defined list through a query does not work.

Any ideas? Thank you.

Private Sub AutoEmail_Click()
Dim Directors As ADODB.Recordset

Set Directors = New ADODB.Recordset
Directors.Open "tbl_DirectorsList", CurrentProject.Connection, adOpenStatic

Do Until Directors.EOF

[Forms]![frm_Email].[Combo29].Value = Directors![Name]
[Forms]![frm_Email].[cbo_Email].Value = Directors![E_Mail]

DoCmd.SendObject acSendReport, "rpt_Privacy Monitoring", acFormatSNP,
[Forms]![frm_Email].[cbo_Email], , , "Report: Privacy Rounds", , True


Directors.MoveNext
Loop

End Sub
 
Works great, thank you....learned something new AGAIN. What you guys have
forgotten is more than I will ever know. I appreciate your help

Alex Dybenko said:
Hi,
try to use report's NoData event, and set Cancel = True there

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com


Jeff C said:
I am using the following to generate an email with the attached report, one
for each Director. The report is based on a query which has a date
criteria
based on a textbox entry on frm_Email. It also has for criteria the entry
[Forms]![frm_Email].[Combo29] in the appropriate field. The results
attach
the appropriate report to an e-mail to the matching director.

This loops through for every Director which sends some an empty report if
they had no entries on a certain date requested. How can I resolve the
empty
report problem?

My frm_Email has a record source of tbl_DirectorsList so switching to a
defined list through a query does not work.

Any ideas? Thank you.

Private Sub AutoEmail_Click()
Dim Directors As ADODB.Recordset

Set Directors = New ADODB.Recordset
Directors.Open "tbl_DirectorsList", CurrentProject.Connection,
adOpenStatic

Do Until Directors.EOF

[Forms]![frm_Email].[Combo29].Value = Directors![Name]
[Forms]![frm_Email].[cbo_Email].Value = Directors![E_Mail]

DoCmd.SendObject acSendReport, "rpt_Privacy Monitoring", acFormatSNP,
[Forms]![frm_Email].[cbo_Email], , , "Report: Privacy Rounds", , True


Directors.MoveNext
Loop

End Sub
 
Back
Top