sending an email from access

  • Thread starter Thread starter dendic
  • Start date Start date
D

dendic

Guest
I'm sending an email from a form to Outlook express. But before it opens Outlook I get a question that states "a program is trying to access email address you have stored in Outlook" I then have to click ok and then another window opens and askes the same question. How can I eliminate these warning messages??
Thank You
 
Email from access directly

have a button next to an email field with the following code:

Private Sub EmailButton_Click()
On Error GoTo Err_EmailButton

If IsNull(Me.EmailAddress) Then
MsgBox "Please enter a valid email address", , "Email Out"
Else
DoCmd.SendObject , , , (Me.EmailAddress)
End If

Exit_EmailButton_Click:
Exit Sub

Err_EmailButton:
MsgBox Err.Description
Resume Exit_EmailButton_Click

End Sub

Where the field that contains the email address is called EmailAddress. This starts your default email program and inserts the email address.

PS using this you dont need the Mailto: bit

Look up SendObject in VB help

Steve
 
I'm using this code and within it I can send a message. How you I do this using your suggestion.

Sub SendMessage(DisplayMsg As Boolean, varEmail, varMessage, Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
If IsNull(varEmail) Then
varEmail = "Enter Address"
End If
Set objOutlookRecip = .Recipients.add(varEmail)
objOutlookRecip.Type = olTo

' Add the CC recipient(s) to the message.
'Set objOutlookRecip = .Recipients.add("Michael Suyama")
'objOutlookRecip.Type = olCC

' Add the BCC recipient(s) to the message.
'Set objOutlookRecip = .Recipients.add("Andrew Fuller")
'objOutlookRecip.Type = olBCC

' Set the Subject, Body, and Importance of the message.
.Subject = ""
.Body = (varMessage) & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
'If Not IsMissing(AttachmentPath) Then
'Set objOutlookAttach = .Attachments.add(AttachmentPath)
'End If

' Resolve each Recipient's name.
'For Each objOutlookRecip In .Recipients
'objOutlookRecip.Resolve
'Next

' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.save
.Send
End If
End With
Set objOutlook = Nothing
End Sub
Thanks
 
code

I think this code only works with full blown outlook
 

Users who are viewing this thread

Back
Top Bottom