我需要根据报告的分组依据从 MS Access 2013 中通过电子邮件发送报告的各个部分。
最佳情况:单击单个按钮时,每个“UW”将仅接收分配给它们的行。
第二个最佳案例:每个分组的部分都有一个按钮。单击每个按钮时,该部分分组的“UW”将仅接收分配给它们的行。
这个来自 Access 2013 VBA 的带有 SQL 脚本的VBA:查询收件人电子邮件地址允许我创建发送给 UW 的 Outlook 电子邮件,但不一定是报告分组依据的 UW。
Dim varSubject As Variant
Dim varBody As Variant
Dim email as string
Dim sqlSTR as string
Dim r As DAO.Recordset
Dim varInitials as string
Dim dbs as DAO.database
set dbs = currentDB()
varInitials = "P.UW"
sqlSTR = "SELECT E.Email FROM Employee E INNER JOIN ProposalTracking P ON
E.Initials = P.UW WHERE " & someField & " = & " & """" & someVariable & """"
Set r = dbs.OpenRecordset(Name:=sqlSTR , Type:=dbOpenSnapshot)
varName = r![Email]
r.close
varSubject = "Today's Proposals"
varBody = "Please see the proposals which are assigned to you."
DoCmd.SendObject , , , varName, , , varSubject, varBody, True, False
如何通过尽可能少的点击向多个 UW 发送报告分组的多个 UW?