![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a combo box that based on what is selected populates a list box. When the user creates a report, I create a variant that stores the combo box value and the selected list box values. However, when I look at the individual rows in the variant, I am seeing values from the list box that were not selected. How to I make sure that ONLY the rows that are selected (have been clicked on and remain highlighted) are added to the variant? My code: Private Sub cmdCreateReport_Click() Dim varitem As Variant Dim varParameter1() As Variant Dim ctl As Control Dim intLstCount As Integer Dim intCount As Integer 'add the parameter values into an array and run the function 'Parameter 1 Set ctl = Me.lstParameter1Values intCount = 0 For intLstCount = 0 To Me.lstParameter1Values.ListCount If Me.lstParameter1Values.Selected(intLstCount) = True Then varParameter1(intCount) = Me.cboParameter1.Column(1) & ";" & ctl.Column(2, intCount) intCount = intCount + 1 End If Next End Sub |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Thank you. The ItemsSelected helped. My larger issue was the ctl.Column(2,intcount), which was pulling the correct column from the list box, but the incorrect row. |
![]() |
| Thread Tools | |
| Display Modes | |
| |