type mis-match

peterbowles

Registered User.
Local time
Today, 21:15
Joined
Oct 11, 2002
Messages
163
I am using the following code to send emails

Dim strEmail As String
Dim rst As Recordset
Dim x As Integer

Set rst = Me.RecordsetClone


rst.MoveFirst
Do

'Place all the email address into the TO: field
strEmail = Trim(strEmail & rst!Email & ";")
rst.MoveNext
Loop Until rst.EOF

'Remove final ';'
x = Len(strEmail) - 1
strEmail = Left(strEmail, x)

DoCmd.SendObject acSendNoObject, , , strEmail

I know this works I use it on another DB, but on this one when I press the button I get a type mis match error and the following line is highlighted

Set rst = Me.RecordsetClone
 
If you are using ADO, you can use:-

Dim rst As Object

instead of dimensioning it as Recordset
because a form's recordset is by default a DAO recordset.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom