我正在使用 MS 访问查询,我想从查询中提取所有电子邮件,然后用所有电子邮件填充 Outlook 电子邮件,代码将运行,但它不会提取电子邮件地址,我似乎无法弄清楚为什么..这是我到目前为止所拥有的。我的想法是在尝试提取电子邮件时未调用填充表中使用的查询
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click
Dim stDocName As String
stDocName = "Department E-Mail"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Dim r As Recordset
Dim Email As String
Set r = CurrentDb.OpenRecordset("SELECT[tbl dmgrphcs].Email FROM [tbl dmgrphcs]WHERE(([tbl dmgrphcs].Email) Is Not Null);")
Do While Not r.EOF
Email = Email & r(0) & ";"
r.MoveNext
Loop
r.Close
DoCmd.SendObject acSendNoObject, Null, Null, "", "", Email, "", "", True, Null
Exit_Command30_Click:
Exit Sub
Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click
End Sub