Pass email address from a Form to a Send Object Module

russiver

Registered User.
Local time
Today, 13:58
Joined
Dec 19, 2003
Messages
41
My database has a form to input new member details. Once their details have been input I need to send them a confirmation email (message in a report attachment - Confirmation_email). Although I have achieved this manually inputting the recipient’s email address, should it be possible to pass the recipient’s email address from the input from to the email. Here is the code I have trying unsuccessfully:

'------------------------------------------------------------
' Confirmation_email
'
'------------------------------------------------------------
Function Confirmation_email()
On Error GoTo Confirmation_email_Err

DoCmd.SendObject acReport, "Confirmation_email", "HTML(*.html)", "Forms![Membership Application Form]! ", "", "", "Membership Confirmation", "Please see attached", False, ""


Confirmation_email_Exit:
Exit Function

Confirmation_email_Err:
MsgBox Error$
Resume Confirmation_email_Exit

End Function[/QUOTE]


Many thanks

Russell
 
re:

Hi,
if the procedure is executed from the form this control holding the value is in then use:

DoCmd.SendObject acSendReport, "Confirmation_email", acFormatHTML, Me.email,,, "Membership Confirmation", "Please see attached", False

If not on the current form then use:

DoCmd.SendObject acSendReport, "Confirmation_email", acFormatHTML, Forms![Membership Application Form]!email,,, "Membership Confirmation", "Please see attached", False

Try to NOT use spaces in field/control/object...names.
HTH
Good luck
 
Many thanks.

The first method works fine and I've also tidied up my filed names etc.

Russell
 

Users who are viewing this thread

Back
Top Bottom