Code Problem

peterbowles

Registered User.
Local time
Today, 17:40
Joined
Oct 11, 2002
Messages
163
I am trying to send an email to a list of people The code sort of works I get this error

User-defined type not defined

Dim rsEmail As DAO.Recordset - this is the highlighted line

Dim strEmail As String


Set rsEmail = CurrentDb.OpenRecordset("EmailList")
strEmail = rsEmail.fields("Email").Value
rsEmail.MoveNext

Do While Not rsEmail.EOF
strEmail = strEmail & " ; " & rsEmail.fields("Email").Value

rsEmail.MoveNext

Loop
DoCmd.SendObject , , , strEmail, , , "Test 7", Text2, False
Set rsEmail = Nothing
MsgBox "Emails have been sent"

End Sub
 
Check your references. This is an indication that the DAO Reference is not there or needs to be refreshed.
 

Users who are viewing this thread

Back
Top Bottom