从 Access 2010 VBA 中的记录集创建邮件列表?
我正在尝试从表中提取电子邮件地址并将其格式化为可在 Outlook 邮件的“收件人:”字段中使用的字符串。由于某种原因,我编写的循环冻结了程序。谁能发现我做错了什么或提供更好的方法来做到这一点?这是我现在的代码:
Private Function GetMailingList() As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim results As String
results = ""
Set db = CurrentDb
Set rs = db.OpenRecordset("lut_holdEmailList")
Do Until rs.EOF
results = results & rs.Fields("emailAddress") & ", "
Loop
GetMailingList = results
End Function
I'm trying to pull email addresses from a table and format them into a string that can be used in the "TO:" field of an outlook message. For some reason, the loop that i wrote is freezing the program. Can anyone spot what I'm doing wrong or offer a better way to do this? here is the code i have at the moment:
Private Function GetMailingList() As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim results As String
results = ""
Set db = CurrentDb
Set rs = db.OpenRecordset("lut_holdEmailList")
Do Until rs.EOF
results = results & rs.Fields("emailAddress") & ", "
Loop
GetMailingList = results
End Function
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
您错过了
MoveNext
调用:将此行添加到 Do Untill 循环中
You missed the
MoveNext
call:add this line to the Do Untill Loop