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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

cutephoenixchick86

New Member
Joined
Sep 21, 2006
Messages
3
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
 

VicRauch

Well-known Member
Joined
Mar 23, 2006
Messages
2,032
Shannon Ann,

Good job. We always like to see when others have found an answer and share it with the whole board. Thanks!
 

rmtimmah

Board Regular
Joined
May 14, 2007
Messages
153
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?
 

VicRauch

Well-known Member
Joined
Mar 23, 2006
Messages
2,032

ADVERTISEMENT

please post the actual code you have in your application.
Thanks
 

rmtimmah

Board Regular
Joined
May 14, 2007
Messages
153
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"
 

VicRauch

Well-known Member
Joined
Mar 23, 2006
Messages
2,032

ADVERTISEMENT

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.
 

rmtimmah

Board Regular
Joined
May 14, 2007
Messages
153
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.....
 

VicRauch

Well-known Member
Joined
Mar 23, 2006
Messages
2,032
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?
 

rmtimmah

Board Regular
Joined
May 14, 2007
Messages
153
Tried that too. Even put a 1 email address in the To field and a different email address in the CC field and both get doubled up. There is no comma or any thing in between the duplicates. It just weird. Shows up name@domain.comname@domain.com
 

Forum statistics

Threads
1,141,757
Messages
5,708,336
Members
421,566
Latest member
7Nabisco

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
Top