Email Generating Form

SoxPats83

Registered User.
Local time
Today, 17:51
Joined
May 7, 2010
Messages
196
i would like to design a form that has a To: field with a dropdown that has multiple email addresses, same with the CC:, and a predetermined Subject line. the body of this email that i would like to generate should be composed by the user entering values in various text boxes. however, where i run into a problem is i would like the "various text boxes" values to be re-alligned and strategically placed in what would be the end result of the email body. lastly i am wanting a command button along the bottom of this form to send the email and close the form. i am hoping that the sending of this email will not generate any pop ups of any kind and would be a very user friendly, easy to use template.

any thoughts?
 
That's a little vague. You can use vbCrLf in code to add a carriage return to build a formatted email:

strBody = "Dear " & Me.FirstName & "," & vbCrLf & vbCrLf & "Here's your email."

which will result in:

Dear Paul,

Here's your email.
 
That's a little vague. You can use vbCrLf in code to add a carriage return to build a formatted email:

strBody = "Dear " & Me.FirstName & "," & vbCrLf & vbCrLf & "Here's your email."

which will result in:

Dear Paul,

Here's your email.
i'm not at all familiar with the vbCrLf . what is the codes primary function/purpose?
 
As I said, it adds a carriage return in the string (like hitting the Enter key typing text). As you can see from the example, the single line of code would produce 3 lines in the email.
 
basically what i am looking for is this... the form has a couple of list boxes. one of those list boxes has many email addresses in it. the user should be able to select one or multiple email addresses (i already have the box formatted to allow multiple selections) and these selections should generate the To: field within Outlook, the other list box has "zones" listed in it. the user should be able to select one or multiple of these "zones" (again, i have it formatted correctly) having these selections formulate the Subject line, preceded by today's date, followed by specific words. i would like the To: line and Subject line to appear on this form but in disabled and locked status for the end user's viewing. Lastly i would like a series of text boxes that the end user would be able to type values into, that would then populate into the email's Body in a format that i would like predetermined.
 
i currently have my form created and set up, i am just having problem with the coding. based on my above post, would anyone have any good ideas as too how i can accomplish my goal?
 
What part exactly are you stuck on?
 
What part exactly are you stuck on?
i have a couple of problems going right now. the first is i have a list box with many email addresses in it. i want the user to be able to select one or multiple email addresses and then click on a command button that will take the selected email addresses and place them into the "To:" field that i currently have on the form. then the same thing with another command button for "Cc:". then i have the subject line where i would like a specific sequence of wording to occue. first today's date, followed by (similar to above) selections made by the user from another list box after clicking a different command button, then followed by a specific three word phrase. then i have the body... i would like the body to be formatted in a very specific layout. i would like it to have bullet points and phrasing based upon values typed in other fields.

possible?
 
I take you don't have any existing code to start this whole thing? Here's the basic multi-select listbox code. You can modify it to create a delimited string for your addresses:

Code:
  Dim ctl         As Control
  Dim varItem     As Variant

  Set ctl = Me.lstDriveConcern
  For Each varItem In ctl.ItemsSelected
    'ctl.ItemData(varItem) regular version
    'ctl.Column(0, varItem) use this if you need columns
  Next varItem

  Set ctl = Nothing
 
I take you don't have any existing code to start this whole thing? Here's the basic multi-select listbox code. You can modify it to create a delimited string for your addresses:

Code:
  Dim ctl         As Control
  Dim varItem     As Variant
 
  Set ctl = Me.lstDriveConcern
  For Each varItem In ctl.ItemsSelected
    'ctl.ItemData(varItem) regular version
    'ctl.Column(0, varItem) use this if you need columns
  Next varItem
 
  Set ctl = Nothing
i have been able to create the command buttons that will populate my To:, Cc:, and Subject lines on this form. i am now runing into the whole populating the Body of the email portion of my question. what i am asking sounded a bit far fetched, but after reading these forums, i have come to believe that you can pretty much do anything in Access with a little help.
 
You probably can, since you can include HTML formatting. If you get stuck, post a specific question with your attempt at the code. No one can help with "formatting in a very specific layout" without knowing the specifics.
 
You probably can, since you can include HTML formatting. If you get stuck, post a specific question with your attempt at the code. No one can help with "formatting in a very specific layout" without knowing the specifics.
alright. i have text box A, B, & C. the user will fill in the values of these three text boxes and click on a command button too add to the email body text box. imagine text box A had "Bob", B had "is", & C had "Tall". after the click of the command button, i would like this information to be passed to the Body text box and appear as so:

- Bob, is, Tall

that is basically what i am shooting for on the email body side of things.

in regards to the subject line, i would like things to open with today's date ("=Date()"?), and then followed with the options selected in a different list box that will be populated from a command button (but after the click, not to overwrite the Date, but merely add onto the line, and aft6er those selections are made i would like the subject line to close out with a three word phrase like, "Bob is Tall".
 
My first post demonstrated how to concatenate fixed text with the contents of textboxes.
 
i am hoping that the sending of this email will not generate any pop ups of any kind and would be a very user friendly, easy to use template.

Depending on your site security rules, attempting to send e-mail will generate an ugly pop-up saying that a program is trying to send automated e-mail. How you fix that involves some gyrations that require the cooperation of your security group.
 
I take you don't have any existing code to start this whole thing? Here's the basic multi-select listbox code. You can modify it to create a delimited string for your addresses:

Code:
  Dim ctl         As Control
  Dim varItem     As Variant
 
  Set ctl = Me.lstDriveConcern
  For Each varItem In ctl.ItemsSelected
    'ctl.ItemData(varItem) regular version
    'ctl.Column(0, varItem) use this if you need columns
  Next varItem
 
  Set ctl = Nothing
is there any more to this code that will help move the data into my "txtBody" field? i'm sorry i am just a bit lost on this. i type values into a text box called "txtNumber" and then click on a command titled "cmdAddToBody1" and i am hoping the values entered will then popup in the bodt text.
 

Users who are viewing this thread

Back
Top Bottom