K
Kevin Bruce
On a form, I have placed a command button that opens the user's email client
and places the email address from records in a query into the 'To' line. The
process works fine in a copy of the database that I was working in to
develop this, but when imported into the original database I get a 'Type
mismatch error' when I attempt to run it. The highlighted error line is:
"Set recEvents = db.OpenRecordset(strQuery)".
All of the references in the data library are the same in both the copy and
the original.
Any help would be appreciated.
Below is my code for the command button in its entirety.
Thanks.
_Kevin
Private Sub cmdSendEmail_Click()
Me.Refresh
Dim strQuery As String
strQuery = "qryMyQuery"
Dim strTo As String
Dim db As Database
Dim recEvents As Recordset
Set db = CurrentDb()
Set recEvents = db.OpenRecordset(strQuery)
While Not recEvents.EOF
strTo = recEvents("Email") & ";" & strTo
recEvents.MoveNext
Wend
DoCmd.SendObject acSendNoObject, , , strTo, , , , , , True
End Sub
--
================================
Kevin Bruce
Program Coordinator
ArtStarts in Schools
301 - 873 Beatty Street
Vancouver, BC V6B 2M6
ph:604-878-7144 ext.3
fx: 604-683-0501
web: www.artstarts.com
Did you know that you can donate to ArtStarts in Schools directly from our
website? www.artstarts.ca
and places the email address from records in a query into the 'To' line. The
process works fine in a copy of the database that I was working in to
develop this, but when imported into the original database I get a 'Type
mismatch error' when I attempt to run it. The highlighted error line is:
"Set recEvents = db.OpenRecordset(strQuery)".
All of the references in the data library are the same in both the copy and
the original.
Any help would be appreciated.
Below is my code for the command button in its entirety.
Thanks.
_Kevin
Private Sub cmdSendEmail_Click()
Me.Refresh
Dim strQuery As String
strQuery = "qryMyQuery"
Dim strTo As String
Dim db As Database
Dim recEvents As Recordset
Set db = CurrentDb()
Set recEvents = db.OpenRecordset(strQuery)
While Not recEvents.EOF
strTo = recEvents("Email") & ";" & strTo
recEvents.MoveNext
Wend
DoCmd.SendObject acSendNoObject, , , strTo, , , , , , True
End Sub
--
================================
Kevin Bruce
Program Coordinator
ArtStarts in Schools
301 - 873 Beatty Street
Vancouver, BC V6B 2M6
ph:604-878-7144 ext.3
fx: 604-683-0501
web: www.artstarts.com
Did you know that you can donate to ArtStarts in Schools directly from our
website? www.artstarts.ca