Sending Email with value returned

jamie57

Registered User.
Local time
Today, 07:15
Joined
Aug 23, 2002
Messages
15
Is there any way to have a value such as the EntryID, or even a the date/time stamp (SentOn) when sending email by bringing up the outlook new message window?

Currently I thought of two ways to send email:

DoCmd.SendObject acSendNoObject

or

Dim outobj As Outlook.Application
Dim outmail As Outlook.MailItem
Set outobj = CreateObject("outlook.application")
Set outmail = outobj.CreateItem(olMailItem)

With outmail
.Display
End With

Set outtask = Nothing
Set outobj = Nothing


Now, if I use the second one, would it be possible (and would it work) if I could somehow wait until the message was sent and then grab the EntryID or SentOn value? Or is there some other way to do this?
 
jamie57,


If I understand your question correctly this is what you are looking for or at least something similar to this:
Code:
Dim EmailApp, NameSpace, EmailSend As Object
Dim dtDate As Date
Dim strEntId As String

dtDate = Now()
strEntId = Me.EntryID

Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)

EmailSend.To = "emailadd@somewhere.com"

EmailSend.Subject = "This email was sent at: " & dtDate

EmailSend.Body = "Here is your email sent on " & dtDate & _
    vbCrLf & "The entry id for this email is: " & strEntId

EmailSend.Display

Set EmailApp = Nothing
Set NameSpace = Nothing
Set EmailSend = Nothing
 
Hmmm... well, thats not exactly what I wanted, I actually wanted it the other way around... I think i missed a few words in my explanation... I want the outlook new message brought up and then when the message is sent, that the outlook entryid and/or date stamp returned to the access application. But I am starting to think this is not at all possible. But, thanks! If you have any ideas on this, that would be great...
 
Oh I see. Well since you are using Outlook why not turn on the Request Delivery Receipt For Message in Outlook. If you do not want it on all the time there may be a way to turn it on in the code. I will check it out here in a minute and let you know if I find something.
 
Hmm, let me explain what I am trying to do. We are creating a contact management type database. We are going to use outlook features for sending and receiving messages, so when a message is sent we would like to keep some info on it in the database so that when we go to that client's record, we can see a list of all the emails sent to the client. Then we can double click in the listbox to display the outlook actual message based on the EntryID or date stamp. ..
 

Users who are viewing this thread

Back
Top Bottom