Generating emails from Access...

  • Thread starter Thread starter Brad Pears
  • Start date Start date
B

Brad Pears

We have an application where we want to generate the following items within
a users Outlook 2002 client...

1) Generate an email when a certain action is performed
2) Generate an Outlook "task" when a certain action is performed
3) Create an Outlook "Reminder" when a certain action is performed

How hard is it to do these things and how would one go about doing this in
an Access 2000 application?

Thanks,

Brad
 
Got the email part working no problem but I forgot to mention one tiny
tidbit.....

The tasks and appointments I want to create will be for someone else not
myself. How big of a wrinkle does this through into things??

I have to create these items so they show up in someone else's Outlook
client. (We are using Exchange 2000)

Thanks,

Brad
 
Arvin, in your OutlookForms2K project, I would like to use some of that
functionality - specifically the ability to call up the email template from
within Access. When I checked your project, all the code is gone. Obviously
this is on purpose.

So, how would I create a command button in one of my other projects that
opens up the Outlook email component (or any of the others... task, contact,
reminders etc...)

Thanks,

Brad
 
Hi,
I beleive you'll have to the CDO library for this.
It allows you to logon to a MAPI session using different credentials.
You'll still have to know the that 'someone else's' username and password.

I don;t have any CDO samples but it shouldn't be too hard to google on it.
http://support.microsoft.com/?kbid=161833
 
Brad Pears said:
Arvin, in your OutlookForms2K project, I would like to use some of that
functionality - specifically the ability to call up the email template from
within Access. When I checked your project, all the code is gone. Obviously
this is on purpose.

No it isn't. I just checked the website and downloaded the zip file and it
was OK. All the code should be there. Try downloading again, and if that
doesn't work for you, post back and I'll post the code here.

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Arvin, I have a question regarding your email code as well that maybe you
have run into before....

When I run the Access app on an XP machine or a Win2K3 terminal server
session, it woprks fine, the email is generated. However, when I run it on a
Windows 2000 terminal server session, it crashes every time with the
following error...

"-2113732605: The operation failed"

This is the line the error is being generated on...

Set objEmail = objOutlook.CreateItem(olMailItem)

Here is the whole procedure...

Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = "(e-mail address removed)"
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End Sub

Have you ever seen this issue before? We need it to work for Win98, WIn2K,
WInXP and Win2K3 users....

Thanks,

Brad
 
Back
Top