Hi,
I have an issue when trying to select a value from a list box I have created using the rowsource property. The following code is what I am using to get values from the selected item within my list box:
Private Sub MyList_Click()
For Each varItm In MyList.ItemsSelected
Info1.Caption = MyList.Column(0, varItm)
Info2.Caption = MyList.Column(1, varItm)
Info5.Caption = MyList.Column(4, varItm)
Next
End Sub
The problem is that during this procedure MyList - which is the list box - seems to lose the row source I set earlier. If I restate the rowsource just before my for each loop the procedure at least picks up a selected item, but it always defaults that item to the first in my listbox.
Does anyone have any idea what I am taling about or have a solution??
Cheers,
Skinicod.
PS an example of a RowSource that I would generate earlier in the code is a follows:
MyList.RowSource = "SELECT table, name, value, count, uniqueobs, tab_percentage from audit where table in(" & StrTab & ");
I have an issue when trying to select a value from a list box I have created using the rowsource property. The following code is what I am using to get values from the selected item within my list box:
Private Sub MyList_Click()
For Each varItm In MyList.ItemsSelected
Info1.Caption = MyList.Column(0, varItm)
Info2.Caption = MyList.Column(1, varItm)
Info5.Caption = MyList.Column(4, varItm)
Next
End Sub
The problem is that during this procedure MyList - which is the list box - seems to lose the row source I set earlier. If I restate the rowsource just before my for each loop the procedure at least picks up a selected item, but it always defaults that item to the first in my listbox.
Does anyone have any idea what I am taling about or have a solution??
Cheers,
Skinicod.
PS an example of a RowSource that I would generate earlier in the code is a follows:
MyList.RowSource = "SELECT table, name, value, count, uniqueobs, tab_percentage from audit where table in(" & StrTab & ");