e-mail code

louiserome

Registered User.
Local time
Today, 03:55
Joined
May 22, 2001
Messages
14
I am using the code below to send bulk e-mails. This code works fine, but what I want to do now is create the mailing list from a query that contains parameter criteria and it keep coming up with and error message saying 'Too few parameters. Expected 1'. Can anyone help me understand why it's saying this and what can I do to correct it.

Many Thanks
Louise

Private Sub lblmail_Click()
Dim db As Database
Dim rsMySet As Recordset
Dim MyString As String
Dim strSQL As String

Set db = CurrentDb()
strSQL = "SELECT [qryparameter].[E-Mail] FROM [qryparameter]"
Set rsMySet = db.OpenRecordset(strSQL)
MyString = rsMySet("E-Mail")
Do
MyString = MyString & ";" & rsMySet("E-Mail")
rsMySet.MoveNext
Loop Until rsMySet.EOF
rsMySet.Close
Set rsMySet = Nothing
Set db = Nothing
DoCmd.SendObject acSendNoObject, acSendNoObject, , MyString, , , "bla", "bla", -1

End Sub
 
Usually that will have to do with your SQL statement.... Maybe you spelled something wrong.. Try creating a query, using your qryparamter query and just taking your E-Mail field. Then go to SQL view and copy and paste that statement into your code... That should do it for you. HTH

Doug
 

Users who are viewing this thread

Back
Top Bottom