T
tminn
I'm trying to create a button in a form that will send a mass email the
user-selected group. I have created a query (qryEmailBoard) that works fine
when I use it with the form open. When I click the button, however, I get an
error message "too few parameters: Expected 2" at the line "Set rst =
db.OpenRecordset("qryEmailBoard")" Here is the code that I am using:
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim strEmail As String
Set db = CurrentDb()
Set rst = db.OpenRecordset("qryEmailBoard")
With rst
If (Not .BOF) And (Not .EOF) Then
.MoveFirst
strEmail = .Fields("email")
.MoveNext
End If
If (Not .BOF) And (Not .EOF) Then
Do Until .EOF
strEmail = strEmail & ", " & .Fields("email")
.MoveNext
Loop
End If
.Close
End With
If strEmail = "" Then
MsgBox "No email addresses were found for that Board"
Else
DoCmd.SendObject acSendNoObject, , acFormatTXT, strEmail, , ,
"Subject", "Message", True
End If
End Sub
Any help with this would be greatly appreciated
user-selected group. I have created a query (qryEmailBoard) that works fine
when I use it with the form open. When I click the button, however, I get an
error message "too few parameters: Expected 2" at the line "Set rst =
db.OpenRecordset("qryEmailBoard")" Here is the code that I am using:
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim strEmail As String
Set db = CurrentDb()
Set rst = db.OpenRecordset("qryEmailBoard")
With rst
If (Not .BOF) And (Not .EOF) Then
.MoveFirst
strEmail = .Fields("email")
.MoveNext
End If
If (Not .BOF) And (Not .EOF) Then
Do Until .EOF
strEmail = strEmail & ", " & .Fields("email")
.MoveNext
Loop
End If
.Close
End With
If strEmail = "" Then
MsgBox "No email addresses were found for that Board"
Else
DoCmd.SendObject acSendNoObject, , acFormatTXT, strEmail, , ,
"Subject", "Message", True
End If
End Sub
Any help with this would be greatly appreciated