I can't seem to find the right answer....
The following code puts the text box contents in the "To:" section of the email. But on the form, the text box only includes the person's last name and I want it to go to a table and pull either FullName or Email and put it into the "To:". (it's not a huge list of people and there are no duplicate last names so far) Any advice is appreciated.
___________________________________________
Private Sub txtLastName_DblClick(Cancel As Integer)
Dim Email As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
'Gathers info from the form. This sets the string variable to the field(s).
Email = Me!txtLastName
'Creates an instance of Outlook.
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = Email
.Subject = "Weely Specials"
.Display 'Creates and displays the email."
End With
Exit_txtLastName_DblClick:
Exit Sub
End Sub
___________________________________________
The following code puts the text box contents in the "To:" section of the email. But on the form, the text box only includes the person's last name and I want it to go to a table and pull either FullName or Email and put it into the "To:". (it's not a huge list of people and there are no duplicate last names so far) Any advice is appreciated.
___________________________________________
Private Sub txtLastName_DblClick(Cancel As Integer)
Dim Email As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
'Gathers info from the form. This sets the string variable to the field(s).
Email = Me!txtLastName
'Creates an instance of Outlook.
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = Email
.Subject = "Weely Specials"
.Display 'Creates and displays the email."
End With
Exit_txtLastName_DblClick:
Exit Sub
End Sub
___________________________________________