Setting a Email button on a Form

D

DDrowe

I want a button that the users of the form can hit that will automatically
pull up a new email message with my address in the To slot that the user can
then send with any questions or updates.

Thanks

David
 
D

DDrowe

That worked great but one question. If I click the button, and then close
the message without sending it I get an error message:

"Run-time error '2501'
The SendObject Action was canceled."

I can see someone doing this and this freaking them out. Is there simple
code that I can put in to avoid this message?

Thanks again.

David
 
O

Ofer

You can add an error capture and ignore this error


On Error GoTo StartOutLook_Error

DoCmd.SendObject acSendNoObject, , , "[email protected]"

StartOutLook_Error:
If Err <> 2501 Then ' Ignore the error
MsgBox "Error: " & Err & " " & Error
End If
Exit Function
 
R

Ruth Allen

Or you can ditch the programming and use FrontPage's built-in function.
Insert a hyperlink and choose email address. When you type in your email
address, the function code 'mailto:' automatically precedes your email
address. You can also define the email message subject. To program a button
or any graphic, simply link it (a href=) to the mailto function. In summary,
all you need is this code - 'mailto:<your email address>'.
 
P

Pawel J. Glowacki

Try this on the OnClick event
Docmd.SendObject acSendNoObject,,,"[email protected]"

It's also possible to specify subject and message text when sending email
that way. My question is, how to perform basic formatting in message body?
How to put new line in message?

Thanks,
 
V

Van T. Dinh

Subject & Body Text: Yes.
Formatting: No - not with SendObject, AFAIK.
New Line: use vbCrLf (which is Chr(13) + Chr(10)) in your String
construction.

Check Access VB Help on SendObject method for different arguments.
 
M

MMouse

Ok, so I have my button, I saved the code provided by Ofer and it's working
well. Now I'd like to have the Subject and body of the message a standard
form. How does this get entered?
MMouse
 
Top