I want to select a value from the text box based on the value that is inputted into my combo box
You will find my current code on the bottom. I have dimmed the combo box, I want column 3 of the combo box named Primary Email. For the life of me I cannot figure it out. Any help would be helpful and appreicated
You will find my current code on the bottom. I have dimmed the combo box, I want column 3 of the combo box named Primary Email. For the life of me I cannot figure it out. Any help would be helpful and appreicated
Code:
Private Sub Command46_Click()
Dim db As DAO.Database
Dim MailList As DAO.Recordset
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim Subjectline As String
Dim BodyFile As String
Dim MyBodyText As String
Dim Form_Table1 As Form
Dim Test0 As ComboBox
' First, we open Outlook...
Set MyOutlook = New Outlook.Application
' Set up the database and query connections
Set Frm = Form()
Set MailList = Test0
' This creates the e-mail
Set MyMail = MyOutlook.CreateItem(olMailItem)
' This addresses it
MyMail.To = MailList("Primary Email")
' This assigns the FROM
MyMail.SentOnBehalfOfName = "Test"
'This gives it a subject
MyMail.Subject = "Test Subject"
'This gives it the body
MyBodyText = "Good Morning" & vbNewLine & vbNewLine _
MyMail.Body = MyBodyText
' MyMail.Send
'Some people have asked how to see the e-mail
'instead of automaticially sending it.
'Uncomment the next line
'And comment the "MyMail.Send" line above this.
MyMail.Display
'And on to the next one...
MailList.MoveNext
'Cleanup after ourselves
Set MyMail = Nothing
'Uncomment the next line if you want Outlook to shut down when its done.
'Otherwise, it will stay running.
'MyOutlook.Quit
Set MyOutlook = Nothing
MailList.Close
Set MailList = Nothing
db.Close
Set db = Nothing
End Sub