Docmd.OpenReport显示第一条记录,但未在记录集中休息

问题描述 投票:0回答:1

我正在使用下面的代码通过一个记录集并将单个报告发送给一个人。一切正常,但除第一个报告外,所有报告的openreport预览均为空白。试图弄清楚为什么它会向该人发送正确的报告。它的行为就像是打开一个报表并显示然后关闭它,但是只有空白页。任何想法将不胜感激!

Private Sub Command0_Click()


Dim daDb As DAO.Database
Dim daRs As DAO.Recordset
Dim sSql As String

sSql = "SELECT * FROM EmailedContributions;"

Set daDb = CurrentDb
Set daRs = daDb.OpenRecordset(sSql, dbOpenSnapshot)

Do Until daRs.EOF


Debug.Print daRs!MemberID
Debug.Print daRs!EmailName
DoCmd.OpenReport "Copy Of IRS Contribution Letter", acViewPreview, , "MemberID = " & daRs!MemberID,   acWindowNormal
DoCmd.SendObject acSendReport, "Copy Of IRS Contribution Letter", acFormatPDF, daRs!EmailName, , , "IRS Contributions", "Attached are your contributions", False
DoCmd.Close acReport, "Copy Of IRS Contribution Letter"

Debug.Print daRs!EmailName
daRs.MoveNext

Loop

daRs.Close
Set daRs = Nothing
Set daDb = Nothing



End Sub
access-vba
1个回答
0
投票

报告的数据来源是什么?你有条件吗?

© www.soinside.com 2019 - 2024. All rights reserved.