B
Brendan MAther
I'm trying to send emails to various contacts that come up in a form based
on a query, however, when I click on the 'email' button it prompts me that
"A Program is trying to access e-mail addresses you have stored in Outlook.
Do you want to allow this?
If this is unexpected, ......."
I would rather this didn't show up after clicking the "email" button, is
there some code that I can input here to disable this message?
This is the code I'm using on the button click:
Private Sub Emailcommand_Click()
Dim oApp As Outlook.Application
Dim objNewMail As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
Set oApp = New Outlook.Application
Set objNewMail = oApp.CreateItem(olMailItem)
With objNewMail
rs.MoveFirst
Do While Not rs.EOF
If Len(Trim(rs!email)) > 0 Then
Set objOutlookRecip = .Recipients.Add(rs!email)
objOutlookRecip.Type = olTo
End If
rs.MoveNext
Loop
'.Subject = Me.txtSubject
'.Body = "Your text message here."
'.Attachments "Filename.xxx"
'.Save
.Display
End With
End Sub
Thanks,
Brendan MAther
on a query, however, when I click on the 'email' button it prompts me that
"A Program is trying to access e-mail addresses you have stored in Outlook.
Do you want to allow this?
If this is unexpected, ......."
I would rather this didn't show up after clicking the "email" button, is
there some code that I can input here to disable this message?
This is the code I'm using on the button click:
Private Sub Emailcommand_Click()
Dim oApp As Outlook.Application
Dim objNewMail As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
Set oApp = New Outlook.Application
Set objNewMail = oApp.CreateItem(olMailItem)
With objNewMail
rs.MoveFirst
Do While Not rs.EOF
If Len(Trim(rs!email)) > 0 Then
Set objOutlookRecip = .Recipients.Add(rs!email)
objOutlookRecip.Type = olTo
End If
rs.MoveNext
Loop
'.Subject = Me.txtSubject
'.Body = "Your text message here."
'.Attachments "Filename.xxx"
'.Save
.Display
End With
End Sub
Thanks,
Brendan MAther