I have a table that is 2 columns and stores people's names and their email address. I also have a form with some information to be entered. I want to have a combo box at the bottom of the form where someone can click the box, scroll down to the person they want and select that person. After they select that person I would want a command button that they could click and initiate the email to send only to the person that was selected. Is this possible?
MS Microsoft Access 97 - Email people using a combo box?
In the "on Click" event Property write some simple code:
Docmd.Sendobject...
(go ahead and seach the Access VBA Helpfile for "Sendobject". You can cut %26amp; paste the sample code %26amp; tweak it for your own use.)
Access VBA can refer to Your FORM when using that command string.
So put a Textbox on the form named "EmailBody" and have it string together the info from the form You want to include in the body of the e-mail:
[Field1] %26amp; Chr(10) %26amp; [Field2]
(Chr(10) is a "linefeed" so the data from the next Field will be on next line)
Put a textbox on the form named "EmailAddr" and set it's "DATA" property to = [CombBox].Column(1)
(You may have to play with the syntax using the builder (the "..." on the right hand side of the property field)).
In the code for the Command Button You can now refer to the form for your E-mail Address %26amp; Email Body text:
Forms![MyFormName]![EmailAddr]
Forms![MyFormName]![EmailBody]
If it doesn't like the references set up a temporary textbox and use the builder to get the proper reference syntax, then Cut %26amp; Paste it into the code.
Reply:Yes...This is possible but your going to have to include the Outlook reference in your references for coding. Your also going to need to create the code for the Mapi call. The code is really long and I have an example of this but I cannot paste it here. If you e-mail I could possibly offer it. You could also do a google search for Access e-mail in VBA code to see if you get any hits.
The option is available and can be done.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment