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.
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."
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)))
' 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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.