DoCmd.SendObject in access 2003

  • Thread starter Thread starter Ric Passey
  • Start date Start date
R

Ric Passey

Hi,

I've been using this string as part of my access 2000 databse to create an
email for me.

Now it has stopped filling in the EmailBody bit on Access 2003 machines.

DoCmd.SendObject acSendNoObject, , acFormatTXT, EmailAddress, SupportMail, ,
EmailSubject, EmailBody, True

Is there a new system for access 2003 or some work around.

Ric

P.S. I use outlook 2003 and win XP
 
Well no one managed to help me then :(

I finally came up witht this piece of code which kind of works (but still
has a few errors). It does require the caller to select a number of minutes
that access can use outlook for and say yes though (uts a security thing).

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

On Error GoTo ErrorMsgs

' 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. Substitute
' your names here.
Set objOutlookRecip = .Recipients.Add(EmailAddress)
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(SupportEmail)
objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
.Subject = EmailSubject
.Body = EmailBody & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Display
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
ErrorMsgs:
If Err.Number = "287" Then
MsgBox ("You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail" & _
"addresses to send your message. For more information," & _
"see the document at http://www.microsoft.com/office" & _
"/previous/outlook/downloads/security.asp.")
Else
MsgBox (Err.Number & Err.Description)
End If
 
anyone know the ol type for "from"?


Ric Passey said:
Well no one managed to help me then :(

I finally came up witht this piece of code which kind of works (but still
has a few errors). It does require the caller to select a number of minutes
that access can use outlook for and say yes though (uts a security thing).

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

On Error GoTo ErrorMsgs

' 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. Substitute
' your names here.
Set objOutlookRecip = .Recipients.Add(EmailAddress)
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(SupportEmail)
objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
.Subject = EmailSubject
.Body = EmailBody & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Display
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
ErrorMsgs:
If Err.Number = "287" Then
MsgBox ("You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail" & _
"addresses to send your message. For more information," & _
"see the document at http://www.microsoft.com/office" & _
"/previous/outlook/downloads/security.asp.")
Else
MsgBox (Err.Number & Err.Description)
End If


SupportMail,
 
the error handling bit works better like this

If Err.Number = "287" Then
MsgBox ("You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail" & _
"addresses to send your message. For more information," & _
"see the document at http://www.microsoft.com/office" & _
"/previous/outlook/downloads/security.asp.")
ElseIf Err.Number = "0" Then
Exit Sub
Else
MsgBox (Err.Number & Err.Description)
End If
 
Still no help eh,

well I managed to find it anyways, does anyone read these things??

If you want the from field populated use this

..SentOnBehalfOfName = "FromEmail"

stick in the code just before the body line

Cheers anyway,

ric
 
Great work on returning your own solution to the group.

I appreciate it very much.

There is some new things in your code that I didn't see in the MSD
site.

I am having problems with SendObject as well but mine is because I a
faxing as well. I too thought of using the Outlook objects but I a
having problems finding the way to attach a report without having t
save it to file first then attach it.

Have you come across anything to do this? Let me know.

Henri St Louis
SIS Technologies
Gloucester, ON, Canad
 
cjoan75 said:
I am having problems with SendObject as well but mine is because I am
faxing as well. I too thought of using the Outlook objects but I am
having problems finding the way to attach a report without having to
save it to file first then attach it.

AFAIK it's only SendObject that directly supports Access objects such
as reports.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
Back
Top