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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I send email from Access XP? 1

Status
Not open for further replies.

PKM

Technical User
Jun 26, 2002
17
US
I have a form with a drop down box where I choose who will be assigned to a project.
When a person is chosen, I would like to send them an email indicating that they are now assigned to this project.

Thanks
PKM
 
you can use send object if you are good at VB. If you are using office 2K3 the VB coding is a little easier.
 
I don't quite get your point, IceFall. (DoCmd) SendObject is available in VBA or as a macro in Microsoft Access.
 
SendTo:

If you need an example just ask and I put it up.

Never give up never give in.

There are no short cuts to anything worth doing :)
 
Hi -
Am trying to send an email using a macro (on a form) and the SendObject action.
In the TO box I want to look up the email address from a table.

I am using this statement:
DLookUp("[EmailAddress]","[tlkpPerson]","[Person_No] = " & [Forms]![fsubResourceMgmt_WorkPlanAdmin_WorkPlanToPerson]![Person_No])

But when the macro runs I get this error message:
"Unknown message recipients(s); the message was not sent."

Thanks

 
PKM
It is more usual to start your own thread. I do not usually use macros, so I can only suggest that you check that the DlookUp code is returning the answer you want. From the name, it seems that you may be referring to a subform, if so, you will need to change the reference:

 
Paste this into a module. There is a lot you do not need in there but have a play with it you will also need to change the email address.
You should be able to call the mailto: code
-----------------------------------------
Option Compare Database
Option Explicit

Private Const HH_Gadget_Dialog As Integer = 1
Private Const HH_Whatsit_Dialog As Integer = 2
Private Const HH_Widget_Dialog As Integer = 3
Private Const HH_BSSC_Community As Integer = 4
Private Const HH_Start_Page_Dialog As Integer = 5
Private Const HH_mailto_Dialog As Integer = 6

' Declarations to call the default browser
Private Const SW_SHOWNORMAL = 1

Private Declare Function CxtWebHelp Lib _
"shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Public Sub ShowHelpContext(hwnd As Integer, nContextId As Integer)

Dim strTopic As String
Dim strFullPath As String
Dim strPathOnly As String

' Display help via the HTML Pages of the WebHelp directory or
' URLs of the WebHelp topics
Select Case nContextId
Case HH_Gadget_Dialog
strTopic = "gadget.htm"
Case HH_Whatsit_Dialog
strTopic = "whatsit.htm"
Case HH_Widget_Dialog
strTopic = "widget.htm"
Case HH_BSSC_Community
strTopic = " Case HH_Start_Page_Dialog
strTopic = "webapp.htm"
Case HH_mailto_Dialog
strTopic = "mailto:ME@MY-ADDRESS.COM"
Case Else
strTopic = "notfound.htm"
End Select

' Get the path to the database
strFullPath = CurrentDb.NAME
strPathOnly = Left$(strFullPath, Len(strFullPath) - Len(Dir(strFullPath)))

CxtWebHelp hwnd, vbNullString, strTopic, vbNullString, _
strPathOnly + "\WebHelp\", SW_SHOWNORMAL

End Sub

' These next two functions are called via two Runcode macros
' that are in-turn called by items on the WebHelp menubar/toolbar.
' Note that the first argument is 0 since the menus can't pass
' the correct window handle.
Public Function ShowContents() As Long

ShowHelpContext 0, 5

End Function

Public Function EmailEhelp() As Long

ShowHelpContext 0, 6


Never give up never give in.

There are no short cuts to anything worth doing :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top