2011-09-05 95 views
0

我試圖從表格中拉出電子郵件地址,並將它們格式化爲可用於Outlook郵件的「TO:」字段的字符串。出於某種原因,我寫的循環凍結了程序。任何人都可以發現我做錯了什麼或提供更好的方法來做到這一點?這裏是代碼,我目前的樣子:在訪問2010 vba中創建記錄集的郵件列表?

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

你錯過了MoveNext電話:

此行添加到DO直到循環

rs.MoveNext()