I'm using the following code taken from one of the posts on the forum (thanks to whoever wrote it - can't think of the user at the moment)
It works in Access 2000, but keeps failing in Access 2002 with a 'type mismatch' error, any reasons why this code doesn't work???
It basically scans through the record list and compiles a bulk e-mail list and passes it to Outlook and no it's not for spam mail!
The line that errors is - "Set rst = CurrentDb.OpenRecordset(stSQL)"
Private Sub Command165_Click()
Dim rst As Recordset
Dim stSQL As String
Dim stTO As String
stSQL = "Clients"
Set rst = CurrentDb.OpenRecordset(stSQL)
With rst
.MoveFirst
Do While Not .EOF
stTO = stTO & IIf(stTO <> "", ";", "") & .Fields("E-Mail Address")
.MoveNext
Loop
End With
DoCmd.SendObject acSendNoObject, , , , , stTO, "Information Requested", , True
End Sub
Thanks everyone
It works in Access 2000, but keeps failing in Access 2002 with a 'type mismatch' error, any reasons why this code doesn't work???
It basically scans through the record list and compiles a bulk e-mail list and passes it to Outlook and no it's not for spam mail!
The line that errors is - "Set rst = CurrentDb.OpenRecordset(stSQL)"
Private Sub Command165_Click()
Dim rst As Recordset
Dim stSQL As String
Dim stTO As String
stSQL = "Clients"
Set rst = CurrentDb.OpenRecordset(stSQL)
With rst
.MoveFirst
Do While Not .EOF
stTO = stTO & IIf(stTO <> "", ";", "") & .Fields("E-Mail Address")
.MoveNext
Loop
End With
DoCmd.SendObject acSendNoObject, , , , , stTO, "Information Requested", , True
End Sub
Thanks everyone