Command Button Email

cutephoenixchick86

New Member
Joined
Sep 21, 2006
Messages
3
Hey everyone!

I have a field with an email address in it, called fldEmail

I would like to know what I could do that if a user clicks on a command button it would send an email to the email address listed in the field?

I just want to have the email window open with the email address in the to: field,, not specifically send it from Access.

Does anyone know where I could find how to create this?

Thanks

:biggrin:

Shannon Ann
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
FOUND MY ANSWER

With this code, it will open the default email client, Outlook, Notes, etc.:

Code:
Private Sub Command9_Click()

Dim strRecipient As String

On Error GoTo cmdSend_Click_Err


strRecipient = Email.Value

DoCmd.SendObject , "!", "!", strRecipient, "", "", "", "", True, ""

cmdSend_Click_Exit:
Exit Sub

cmdSend_Click_Err:
MsgBox Error$
Resume cmdSend_Click_Exit

End Sub
 
Upvote 0
Shannon Ann,

Good job. We always like to see when others have found an answer and share it with the whole board. Thanks!
 
Upvote 0
I use this code and in the "To" field I get the name entered twice.

i.e if the email.value field equals "test@test.com" the "To" field in the email would be "test@test.comtest@test.com".

I am using Lotus Notes 6.5

Any ideas?
 
Upvote 0
I have the following code:
Code:
Private Sub Command72_Click()
Dim strRecipient As String

On Error GoTo cmdSend_Click_Err


strRecipient = [Projects.Assigned To].Value

DoCmd.SendObject , "!", "!", strRecipient, "", "", "", "", True, ""

cmdSend_Click_Exit:
Exit Sub

cmdSend_Click_Err:
MsgBox Error$
Resume cmdSend_Click_Exit

End Sub

In the [Projects.Assigned To] field I have the persons name eg."Test". So when the email opens up in the To field it is duplicated - "TestTest"
 
Upvote 0
Code:
DoCmd.SendObject , , , [Projects.Assigned To], , , , , True
I have at least one app that uses the SendObject command, so I looked at it. The above code is what I use, except I put in your email address field. The only difference I could see is that I do not use the "strRecipient" construct. I just use the email address directly in the SendObject command. I also use the actual email address as name@domainname.com rather than what you seem to have which looks like it is only the "name" rather than the entire email address. But for the life of me I see no reason for the name to be duplicated the way you are getting it. I would suggest to not use the "strRecipient" construct, and to try the entire email address. Please let us know which, if either of those, fix the problem.

Have you tried using the Debug feature to see what is in the two fields (strRecipient and [Projects.Assigned To]) just before you assign the value in [Projects.Assigned To] to strRecipient. The double that happens to the name might be happening before this routine.
 
Upvote 0
I removed "strRecipient" and replaced it with an email address and the email still came up with duplicates in the To field. I tried the debug and it all runs fine with no duplicates coming from anywhere. Its strange.....
 
Upvote 0
Try moving the email address to the CC field rather than the To field. Does it still double? Did you try an actual email address "name@domain.com", and if so was that doubled?
 
Upvote 0

Forum statistics

Threads
1,214,639
Messages
6,120,679
Members
448,977
Latest member
dbonilla0331

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top