Hi,
I have a problem with a multi colum listbox. I want the user to be able to click on one of the items and then have various hidden column elements show up in captions on another part of the form.
This all sounds simple enough, however the problem I have is that the Click event does not seem to acknowledge the fact that I have selected a row. I create a row source for the listbox earlier in the program with the following code:
Mylist.RowSource = "SELECT table, name, value, count, uniqueobs, tab_percentage from audit" & Suffix & ";"
And my Click event looks like this:
Private Sub MyList_Click()
For Each varItm In Me.MyList.ItemsSelected
Info1.Caption = MyList.Column(0, varItm)
Info2.Caption = MyList.Column(1, varItm)
Info5.Caption = MyList.Column(4, varItm)
Next
End Sub
What is particularly annoying is that if I place the above code within a button object and click on the button after I have selected a row in my listbox, it works perfectly.
Intrestingly when viewing the form during debug mode all value disappear out of my listbox during the listbox Click event. I have therefore tried to restate the rowsource during the event, which has the effect of always selecting the first row within my listbox. The same thing happens if I refresh the database within the click event.
Any help/ideas would be gratefully received.
Skinicod
I have a problem with a multi colum listbox. I want the user to be able to click on one of the items and then have various hidden column elements show up in captions on another part of the form.
This all sounds simple enough, however the problem I have is that the Click event does not seem to acknowledge the fact that I have selected a row. I create a row source for the listbox earlier in the program with the following code:
Mylist.RowSource = "SELECT table, name, value, count, uniqueobs, tab_percentage from audit" & Suffix & ";"
And my Click event looks like this:
Private Sub MyList_Click()
For Each varItm In Me.MyList.ItemsSelected
Info1.Caption = MyList.Column(0, varItm)
Info2.Caption = MyList.Column(1, varItm)
Info5.Caption = MyList.Column(4, varItm)
Next
End Sub
What is particularly annoying is that if I place the above code within a button object and click on the button after I have selected a row in my listbox, it works perfectly.
Intrestingly when viewing the form during debug mode all value disappear out of my listbox during the listbox Click event. I have therefore tried to restate the rowsource during the event, which has the effect of always selecting the first row within my listbox. The same thing happens if I refresh the database within the click event.
Any help/ideas would be gratefully received.
Skinicod