我正在尝试从表中提取电子邮件地址并将其格式化为可在outlook消息的“TO:”字段中使用的字符串。出于某种原因,我写的循环是冻结程序。谁能发现我做错了什么或提供更好的方法来做到这一点?这是我目前的代码:
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
答案 0 :(得分:0)
您错过了MoveNext
来电:
将此行添加到Do Until循环
rs.MoveNext()