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

email to contents of "email" field

Status
Not open for further replies.

Biglop

IS-IT--Management
Aug 16, 2001
25
0
0
US
Hello,

I want to send an email from an Access 2000 form to the recipient in the "email" field of the active record. I know how to use the SendObject action from a command button, but how do I populate the "To:" argument with the address from my database record?

Thanks.

--Steve
 
in the to argument type the name of the field that holds the email address The hardest questions always have the easiest answers.
 
I tried that but got an error "Unknown message recipient(s); the message was not sent."

Do I have to put the field name in a certain format(it's name is "Email")?

Thanks.
 
No, that should work, however make sure that your e-mail address is valid. The whole thing must be in that field "you@yourplace.com" The hardest questions always have the easiest answers.
 
O.K., here's my code:

Private Sub Command100_Click()
DoCmd.SendObject acSendNoObject, "", acFormatTXT, "Email", , , "My Subject text", "My body text", True
End Sub

"Email" is the name of the field that holds the email addresses. All this code does now is put the word"email" in the To argument.
 
The "EMAIL" should not be in quotes. Also if you are not sending an object, the acFormatTXT is unnecassary, and may cause an error. I would delete it. The hardest questions always have the easiest answers.
 
It still doesn't work...same error.
 
I played around a bit more and it worked! I'm not sure what made the difference. Thanks.

Here's the code that worked:

Private Sub Command100_Click()
DoCmd.SendObject acSendNoObject, "", acFormatTXT, Email, , , "Subject Text", "Body Text", True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top