Hello,
I am using Access to Generate an Outlook Email based on a button click. Currently I have this working with no problem but I want to populate the To: field of the email based on email addresses that are listed in a table instead of hard coding them in. I currently have the below code working but it will only pull in the last email in the table. I was wondering if anyone could help me adjust it so it will loop through the table pulling in all of the addresses?
Apprecaite the help!
I am using Access to Generate an Outlook Email based on a button click. Currently I have this working with no problem but I want to populate the To: field of the email based on email addresses that are listed in a table instead of hard coding them in. I currently have the below code working but it will only pull in the last email in the table. I was wondering if anyone could help me adjust it so it will loop through the table pulling in all of the addresses?
Apprecaite the help!
Code:
Private Function ToNam() As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("EmailList")
With rst
.MoveFirst
Do Until rst.EOF
If IsNull(.Fields(0)) = False Then
ToNam = .Fields(0)
End If
.MoveNext
Loop
End With
Set rst = Nothing
Set db = Nothing
End Function
Comment