E
EAB1977
Hello everyone,
I am having a hard time displaying information from a unbound list box.
To get a little bit of background information, I have a list box that
is populated with plants. Whatever plant I click on, a query runs (via
code) to populate the second list box. The second list box contains
email addresses of contact people for that specific plant.
My trouble is that I cannot display the information when a contact
person is clicked. Below is my code on the click event of the second
list box:
Private Sub lstEmail_Click()
Dim frm As Form
Dim ctlSource As Control
Dim intCurrentRow As Integer
Set frm = Forms!frmPlant
Set ctlSource = frm!lstEmail
For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
Me.txtName.Value = Forms!frmPlant!lstEmail.Column(0)
Me.chkQcManager.Value = Forms!frmPlant!lstEmail.Column(2)
Exit For
End If
Next intCurrentRow
frm.Refresh
Set ctlSource = Nothing
Set frm = Nothing
End Sub
I am having a hard time displaying information from a unbound list box.
To get a little bit of background information, I have a list box that
is populated with plants. Whatever plant I click on, a query runs (via
code) to populate the second list box. The second list box contains
email addresses of contact people for that specific plant.
My trouble is that I cannot display the information when a contact
person is clicked. Below is my code on the click event of the second
list box:
Private Sub lstEmail_Click()
Dim frm As Form
Dim ctlSource As Control
Dim intCurrentRow As Integer
Set frm = Forms!frmPlant
Set ctlSource = frm!lstEmail
For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
Me.txtName.Value = Forms!frmPlant!lstEmail.Column(0)
Me.chkQcManager.Value = Forms!frmPlant!lstEmail.Column(2)
Exit For
End If
Next intCurrentRow
frm.Refresh
Set ctlSource = Nothing
Set frm = Nothing
End Sub