Multiple Email Buttons One Access Form!!!

DebraF

New member
Local time
Yesterday, 19:29
Joined
Aug 1, 2006
Messages
7
Hello to all the Users!
I am new at Access and new to programming.
I have created an Access form that has four labeled control buttons each one with an individuals name. I have the corresponding code:

Private Sub Email_PersonOne_Click()
DoCmd.SendObject acSendNoObject, , , "personone@yahoo.com", , , "Work Request", "A new work request has been submitted."
End Sub

When I have one button and one code the email function works. I want the users to be able to select one out of four people who they want to notify upon completion of the form. So I have four buttons and changed the email address and the names on the buttons but now none of the buttons work.
The code is on the same page separated with just a line between each section.

Does this make sense?
Any input would be greatly appreciated.
Thanks in advance for your time and help.
Sincerely,
DebraF
 
it sounds to me you want to have a button to send an email, and then an option to send it to one of four people?

The way i would do this is have one button that says something like 'send email', and then a combo box beside it that has the different names of the people you could send it to.

within the combo box, make sure the limit to list option is set to yes/true so that they can't type in someone other then the people you are suggesting.

Also, you might want to show the name of the person, but have the email stored also. So the list would show "Joe Bob, Mary Jane" etc, while the data would be "joe@yahoo.com, mary@msn.com".

To do this change the columns for the combo box to two, and in the column widths property, type in '0', representing that the first column would have a width of 0, or be hidden.

then change the datatype to value list, since you are going to type in the emails to be in the list, and then the rowsource would be you typing each email, followed by the persons name. for example:

"joe@yahoo.com,Joe Bob,mary@msn.com,Mary Jane" would be the information as shown before.

then to modify the email code you had before, just put in the combo box value, instead of the email, like so:
Code:
DoCmd.SendObject acSendNoObject, , , ComboBox1.Value, , , "Work Request", "A new work request has been submitted."

hopefully you got all that, its a little much if its new to you, so feel free to ask questions, or put us on the right track if im completely off.
 
in response to the private message i sent you, here is the attachment:
 

Attachments

Elbweb,
The example you sent works if you don't make a selection from the combo box. The email defaults to the first one on the list. I still can't get the email to work once you select whom from the combo box you want the email to be sent. Please help.
Thank you for your time.
 
Last edited:
Have a look at the attached sample, it will should work for you. With this one you can add recipients to a form.

If this this does not work then you may have something wrong with your db, so post back if you have a problem.

elbweb's sample worked fine for me.
 

Attachments

I have gotten your code to work up until the ELSE . I am not sure how you are defining Chr. Where did the numbers 13 and 10 come from?
I am reposting the part that I am difficulty with:
Else
strEMailTo = Me.cboEmailList.Column(3)
MsgBox "An E-Mail will be sent to:" & Chr(13) & Chr(10) & "" & Me.cboEmailList.Column(1) & " at " & strEMailTo
DoCmd.SendObject acSendNoObject, , , strEMailTo, , , "Work Request", "A new work request has been submitted."
End If

I appreciate any further input. I am assuming Chr represents Character that is being defined. Please help to clarify.
Thanks once again in advance for your time and help.
 
I have gotten your code to work up until the ELSE
I assume you are refering to my code.Are you saying, that you are having problems with the code and it stops working or gives you an error after the ELSE?
I am not sure how you are defining Chr. Where did the numbers 13 and 10 come from?
Did you read the note above the code? They are used for line feed in the message box, as I said in the note, if you don't want to use it put a ' in front of it.

You don't say in your reply if the sample I send you is worked.
 
John A,
I am sorry for not clarifying my problem...I barely know what I am talking about. I am learning as I go. The code you gave me stops working without an error message. I see the box that prompts the user to choose a person's name to send an email to but then does not send an email. I think it has to do with the row source queryon the properties of the combo box. I have one table that the form is based on. I created another table just like the one you created. It has three columns:ID,name,email address. I am still trying to follow your example and figure out why it isn't working. I do appreciate all your help.
Sincerely,
Debra
I am not sure what question to ask next so I will have to keep you posted.
 
I also want to thank Elbweb for your help.
I am one step away and can't figure out what is going wrong.
I am still trying to figure it out. I will keep everyone who has kindly responded to my cries or help posted of my progress.
Please let me know if anyone has any further ideas.
Sincerely,
Debra
 
Debra,

You still did not answer this question:
You don't say in your reply if the sample I send you is worked.
The reason I ask this question is because I know that it works on my system but does it work on yours?

If it does not then it could be your email client, references etc.

Post of copy of your db and I will have a look at it.
 
hey, i would first like to appologize, but life/works just been overwhelming lately and i can't get on here as much as i would like.

you say you are one step from getting it finished, what is it thats not working? is this the else statement? what are you trying to do, what do you expect to happen, and what happens instead?

sorry if you said this already, i looked through and couldn't find anything.
 
Hello Folks,
Thanks to your help I have completed my electronic work request form.
I was pointing to the wrong column. I didn't take into account the program counts from zero. I am very excited that I have completed my task.
Thank you for your help and your patience! I am very greatful.
Sincerely,
Debra
 
Also wanna say thanks - this solution is saving us tons of time sending repetitive emails every day. Much appreciated!
 
WrHn85 said:
Also wanna say thanks - this solution is saving us tons of time sending repetitive emails every day. Much appreciated!

Which one? there were 2 posted
 
I ended up using the code submitted by John A. I did get Elbweb's code to work. I used John A's code because I liked the message boxes.
Cheers,
Debra
 
Sorry for the fuzzy response John - yours was exactly suited to our needs and elegant as always...:cool: thanks very much!
 

Users who are viewing this thread

Back
Top Bottom