J
jmh via AccessMonster.com
I have an OnClick button that when clicked will send an email. The
txtProducts1-5 are the different products that will appear on the email. The
txtProducts1-5 are combo boxes. Is there a way that I could make these
checkboxes instead of combo boxes? In other words, I would want five
checkboxes (ckProducts1-5). If ckProducts1 is checked, then in the email I
want to put the actual product, which for ckProducts1 would be “Grapes”. Is
there a way to do this?
Also, I am going to need additional help as I have a lot to do with this code,
I thought I would do this in steps. So bear with me and I appreciate any
help I can get.
Here’s my code:
Private Sub Command45_Click()
'Takes the contents of the fields and put them into variables.
Client = Form.Client
'txtBody = Form.txtBody
txtProducts1 = Form.txtProducts1
txtProducts2 = Form.txtProducts2
txtProducts3 = Form.txtProducts3
txtProducts4 = Form.txtProducts4
txtProducts5 = Form.txtProducts5
'txtbody2 = Form.txtbody2
'txtforceline = Form.forceline
txtMainAddresses = Form.txtMainAddresses
txtCC = Form.txtCC
'Build the body of the E-mail
bodytext = bodytext & "I'm the Vice President of Products" + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts1 + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts2 + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts3 + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts4 + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts5 + Chr(13) + Chr(13)
bodytext = bodytext & "We are honored that you allow us to serve you." + Chr
(13) + Chr(13)
bodytext = bodytext & "Thank you for letting us serve you." + Chr(13) + Chr
(13)
bodytext = bodytext & "http://yahoo.com/" + Chr(13) + Chr(13)
bodytext = bodytext & "Signee Name" + Chr(13)
bodytext = bodytext & "Signee Title"
Dim objOutlook As Object
Dim objmailItem As Object
'Create the Outlook object
Set objOutlook = CreateObject("Outlook.Application")
'Access a new mail item
Set objmailItem = objOutlook.CreateItem(olmailItem)
'Do things with the E-mail
With objmailItem
..To = txtMainAddresses
..cc = txtCC
..subject = "Welcome to Our Company"
..Body = bodytext
..display 'Use .Send if you want the message sent instead of display
End With
Set objmailItem = Nothing
Set objOutlook = Nothing
End Sub
txtProducts1-5 are the different products that will appear on the email. The
txtProducts1-5 are combo boxes. Is there a way that I could make these
checkboxes instead of combo boxes? In other words, I would want five
checkboxes (ckProducts1-5). If ckProducts1 is checked, then in the email I
want to put the actual product, which for ckProducts1 would be “Grapes”. Is
there a way to do this?
Also, I am going to need additional help as I have a lot to do with this code,
I thought I would do this in steps. So bear with me and I appreciate any
help I can get.
Here’s my code:
Private Sub Command45_Click()
'Takes the contents of the fields and put them into variables.
Client = Form.Client
'txtBody = Form.txtBody
txtProducts1 = Form.txtProducts1
txtProducts2 = Form.txtProducts2
txtProducts3 = Form.txtProducts3
txtProducts4 = Form.txtProducts4
txtProducts5 = Form.txtProducts5
'txtbody2 = Form.txtbody2
'txtforceline = Form.forceline
txtMainAddresses = Form.txtMainAddresses
txtCC = Form.txtCC
'Build the body of the E-mail
bodytext = bodytext & "I'm the Vice President of Products" + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts1 + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts2 + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts3 + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts4 + Chr(13) + Chr(13)
bodytext = bodytext & txtProducts5 + Chr(13) + Chr(13)
bodytext = bodytext & "We are honored that you allow us to serve you." + Chr
(13) + Chr(13)
bodytext = bodytext & "Thank you for letting us serve you." + Chr(13) + Chr
(13)
bodytext = bodytext & "http://yahoo.com/" + Chr(13) + Chr(13)
bodytext = bodytext & "Signee Name" + Chr(13)
bodytext = bodytext & "Signee Title"
Dim objOutlook As Object
Dim objmailItem As Object
'Create the Outlook object
Set objOutlook = CreateObject("Outlook.Application")
'Access a new mail item
Set objmailItem = objOutlook.CreateItem(olmailItem)
'Do things with the E-mail
With objmailItem
..To = txtMainAddresses
..cc = txtCC
..subject = "Welcome to Our Company"
..Body = bodytext
..display 'Use .Send if you want the message sent instead of display
End With
Set objmailItem = Nothing
Set objOutlook = Nothing
End Sub