General discussion

Locked

How to send emails from Access 2000

By Big Paul ·
Hi,

I want to create a button on the access form to send some details to the guest to check data is typed in correctly.

You have no idea how difficult this appears to be ~ I have been on Forums, on Microsoft's most valued members and searched high and low ~ no luck!

I have tried Outlook.Application e.g.

Dim outApp As Outlook.Application, outMsg As MailItem
Dim vMessage As String
vMessage = "Please can you reply if the following details are wrong. Thank you. "
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)
With outMsg
'.Importance = olImportanceHigh
.To = Me.[Work E-Mail]
'.CC = "CC EMAIL ADDRESS GOES HERE"
'.BCC = "BCC EMAIL ADDRESS GOES HERE"
.Subject = "Database error checking"
vMessage = vMessage & Me.Firstname & " " & Me.Name
vMessage = vMessage & "Mobile: " & Me.Mobile_Telephone
vMessage = vMessage & "Flight: " & Me.In_Flight_Number
vMessage = vMaeeage & " Passport: " & Me.Passport_Number

' .Body = "YOUR_E-MAIL_MESSAGE_GOES_HERE"
.body = vMessage
'.Attachments.Add "YOUR FILE PATH AND NAME", , , "YOUR FILES NAME"
' If you want the screen to be seen then add the following line
.Display
.Send
'End With

Set outApp = Nothing
Set outMsg = Nothing

And set object e.g. (complains Server is not a defined variable ~ I guess there was some dimming that I did not catch)

Set objmail = Server.CreateObject("CDONTS.NewMail")
With objMail
.From = fromname
.To = toname
.Subject = messagehead
.Body = messagetext
.BodyFormat = CdoBodyFormatText
.MailFormat = CdoMailFormatText
.Importance = CdoNormal
.Send
End With
Set objMail = Nothing

Neither work. Am I going mad? Is it really this difficult?

Thanks for looking
Paul

This conversation is currently closed to new comments.

9 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by BFilmFan In reply to How to send emails from A ...

What version of Exchange server are you using?

Exchange 2003 requires use of CDO.

Collapse -

by The Officer's Mess In reply to How to send emails from A ...

When in VBA, go to Tools --> References. Make sure that Microsoft Outlook x.x Object library is ticked.

Collapse -

by Big Paul In reply to

Thank you for this pointer. I have already checked this, and the right library was not ticked, however this has not solved the overall problem. Regards Paul

Collapse -

by vfeerer In reply to How to send emails from A ...

I do this alot using the DoCmd.SendObject.

Collapse -

by Big Paul In reply to

Thank you. Please also see answer 4 ~ same answer with a bit of guidance which helps understand what you are saying. Thanks again, Paul

Collapse -

by D_Bones In reply to How to send emails from A ...

The bestway is to create a report first and use the SendOjects method. Example I use below.

You can change the email address to a variable if it changes constantly.

Also change the last true to a false if you want to type any details on the email before sending.

If you send to the same destination regularly, get them to install the free Access SNP viewer.

Then they can read Access reports in their natural state. (Just change RTF to SNP)

DoCmd.SendObject acSendReport, "reportname", acFormatRTF, "user@emailaddress", , , "Details to appear in subject", , True

Hope it helps

Collapse -

by Big Paul In reply to

Thank you ~ the extra detail help to understand your reply.
Thanks a lot. Paul

Collapse -

How are you skiping outlok security?

by cgr3 In reply to

Hello,
I have used docmd.sendobject but is showing Outlook warning messages, and enduser has to click and wait.

Did you find a way to skip this outlook security messages?

Collapse -

by Big Paul In reply to How to send emails from A ...

This question was closed by the author

Back to Web Development Forum
9 total posts (Page 1 of 1)  

Related Discussions

Related Forums