Sending an Access Report Via Outlook

mlr0911

Registered User.
Local time
Today, 07:09
Joined
Oct 27, 2006
Messages
155
hello folks. I have built a database that will send an email to recepiants based on a SQL. I am using the docmd.sendobject to send the email. As you know, this option doesn't allow me to specify the "From" field. It automatically selects your default setting in your email.

I know that I can write code to use Outlook (and have before) , but how can I specify the from field? It looks like there isn't an option for that when coding. The reason why I need this is so that my report will use a "team mailbox" that doesn't have size limitations on it (instead of mine which has a 10kb limitation).

Does anyone have an idea or solution?

Thanks for your help.
 
Maybe this will help.

Code:
Dim OutlookApp As Outlook.Application
Dim MailItem As Outlook.MailItem

        'Create Email
        DoCmd.Hourglass True
        Set OutlookApp = New Outlook.Application
        Set MailItem = OutlookApp.CreateItem(olMailItem)
        DoCmd.Hourglass False

        MailItem.To = "someone@somewhere.com"
        
        MailItem.Subject = 'Some Subject"
        
        MailItem.Body = "Some Message"

        MailItem.SenderEmailAddress = "Someone@Somewhere.com"   (OR maybe MailItem.SenderName = "John Smith"  Outlook should resolve the name)

        MailItem.Send
 
FizzyFish

Thanks for the reply. I have tried your example and I get the compile error "Can't assign to read-only property". I have received this error before trying to do this, but can't ever seem to work around it. Do you have another idea or alternative. Again, thanks for your help.
 
I used the .sentonBehalfofName and it works perfectly.

Thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom