Trying to retrieve combobox text in the email body of outlook

kate2008

New member
Local time
Yesterday, 16:20
Joined
Apr 23, 2015
Messages
2
Hello All,

I am trying to fetch combobox dropdown text (in the networks label ) into the email body but in vain.

Me.cmb_Network_1_data.Text is giving the RowID instead of the text inside the combobox.


Whichever networks are selected in the six dropdowns should go to email body as you can find in the attachement




Thanks,
Kate


Code:
Sub update()
Dim oOutlook As Outlook.Application
Dim oEmailitem As MailItem
Dim bodytext As String
On Error Resume Next
Err.Clear
Set oOutlook = GetObject(, "Outlook.application")
If Err.Number <> 0 Then
Set oOutlook = New Outlook.Application
End If

Set oEmailitem = oOutlook.CreateItem(olMailItem)
With oEmailitem
.To = Me.EMAIL

.Subject = "Permissions Update - " & Me.FNAME & Space(1) & Me.LNAME & " -" & Me.SSO & "-QCId_" & Me.QCID

bodytext = "Hi" & Me.FNAME & "<br><br>" & _
"Welcome!" & "<br><br>" & _
"A new user account has been created for you with Sales Assistant access (LA team) for the following network(s):" & _
Me.cmb_Network_1_data.Text


.HTMLBody = bodytext

.Display
End With
Set oEmailitem = Nothing
Set oOutlook = Nothing
End Sub
 

Attachments

I did not download your db but it sounds like you just need to refer to the correct column.
i.e. In the record source, the columns start at 0.
Example: Me.cmbnetwork.Column(1)

HTH
 
I did not download your db but it sounds like you just need to refer to the correct column.
i.e. In the record source, the columns start at 0.
Example: Me.cmbnetwork.Column(1)

HTH

It looks like that is the problem : kate's code is referring to the bound column (or "text"): It should be :
Code:
bodytext = "Hi" & Me.FNAME & "<br><br>" & _
"Welcome!" & "<br><br>" & _
"A new user account has been created for you with Sales Assistant access (LA team) for the following network(s):" & _
[B]Me.cmb_Network_1_data.Column(1)[/B]

Best,
Jiri
 

Users who are viewing this thread

Back
Top Bottom