sending email message with Access user defined type error


L

Linda in Iowa

using access 2003
I have a form based on a query that only shows records based on a date
entered by the user.
When a button on the form is clicked the email program opens with the
subject, message, and email already input. the user just needs to click
send without any addition input to the message.

Here is the code on the button:
Me.EMAIL = Replace(Me.EMAIL, "http://", "mailto:")
DoCmd.SendObject acSendNoObject, , , Me!EMAIL, , , "subject", "message
is entered here"

This works fine, but I would like to cycle through the records and add all
email addresses to one email so it can be sent one time to all instead of
sending to each email.

This code is supposed add the email addresses to the CC of the email, but I
get compile error: user-defined type not defined and
'rst As ADODB.Recordset' on the first line of code is highlighted.

Dim rst As ADODB.Recordset
Dim strCC As String
Set rst = New ADODB.Recordset
rst.Open "qrymemexpnotice", CurrentProject.Connection, adOpenStatic,
adLockOptimistic
With rst
If .RecordCount > 0 Then
Do Until .EOF
If Not IsNull(.Fields("email")) Then
strCC = strCC & .Fields("email") & ";"
End If
.MoveNext
Loop
End If
.Close
End With
Set rst = Nothing
Me.EMAIL = Replace(Me.EMAIL, "http://", "mailto:")
DoCmd.SendObject acSendNoObject, , , Me!EMAIL, strCC, , "subject",
"Message"

how do I fix the user-defined type not defined?

thank you
 
Ad

Advertisements

T

Tom van Stiphout

On Tue, 29 Sep 2009 20:45:54 -0500, "Linda in Iowa"

Make sure you have a reference to the ADO library: Code window > Tools
References > Microsoft ActiveX Data Objects

-Tom.
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top