开发者

creating a mailing list from recordset in access 2010 vba?

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

    GetMaili开发者_如何学CngList = results

End Function


You missed the MoveNext call:

add this line to the Do Untill Loop

rs.MoveNext()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜