Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send an email from access 1

Status
Not open for further replies.

Hokis

Technical User
May 21, 2007
51
US
Hi there,
Is there a way to send an email from a form to a specific email address & i can attach the record that is open in the form?
Thanks
A.
 
As a starting point, have a look at the DoCmd.SendObject method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi,
I'm new in this so can u pls be more secific.
Hokis.
 
'This code will cause an e-mail to be sent
Set ol = CreateObject("Outlook.Application")
Set olns = ol.GetNamespace("MAPI")
Set olmail = ol.CreateItem(olMailItem)
With olmail
.To = "Address you are sending to"
.Subject = "Your Subject"
.body = "Body Text"
.Send
End With


Dan
 
Hi, I did what you said & it gave me an error saying
Assignment to constant not permitted
& it highlighted the
Set olMail = ol.CreateItem(olMailItem)
The 'olMail' was highlighted
Any suggestions?
Thank you
Hokis
 
Any suggestions?
Use the Option Explicit instruction

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi,

I am in a similar situation.

I have a spreadsheet where there should be a few entries and then it should be sent as an email/outlook with the spreadsheet (saved as e.g. 'entry1' in the spreadsheet) and then attached to the email + subject: 'entry1'. The email where it is to be sent is the same each time.

Is it easily doable to create a macro button (e.g. 'SEND') to execute this.

I am quite new to VBA.

Any suggestions or example codes would be greatly appreaciated.

zimba
 
I got this to work in EB
Code:
 Set ol = CreateObject("Outlook.Application")
  Set olns = ol.GetNamespace("MAPI")
  Set olmail = ol.CreateItem(olMailItem)
  With olmail
      .To = "Address you are sending to"
      .Subject = "Your  Subject"
      .body = "Body Text"
      .Send
  End With

But i'm wondering is there a way to take away that annoying message box that comes up that makes me wait 4 seconds to send the email?
 
Either replace this:
.Send
with this:
.Display

Or do a google search for outlook object model guard

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top