How to send emails from Access 2000 - TechRepublic
General discussion
May 11, 2005 at 07:16 AM
big paul

How to send emails from Access 2000

by big paul . Updated 17 years, 2 months ago

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 discussion is locked

All Comments