L
lwert
I have a list box with a list of names, each with an ID in column 0.
I select a name and click on a button, which sends me off to a subform that
allows the name to be edited, etc. When I return to the list, I requery the
list and I want to have the same item that was selected when I left to be
selected again. I save the NameID before going to the subform to do this.
The code to reselect the item looks like this:
For i = 0 to MyList.ListCount - 1
If MyList.column(0,i) = NameID then MyList.selected(i) = True
next i
When I see the list, the item in question is indeed highlighted, but there
is a dotted box around the first item in the list.
If I then try to extract information about the selected item using
msgbox MyList.column(0)
I get an error that says "Invalid use of Null", which means it is not
actually addressing the highlighted record. If I then click on the record,
then everything works fine.
I have multiselect set to Extended if that makes any difference.
Can someone explain what is going on here and the best way to get around it?
Thanks...
I select a name and click on a button, which sends me off to a subform that
allows the name to be edited, etc. When I return to the list, I requery the
list and I want to have the same item that was selected when I left to be
selected again. I save the NameID before going to the subform to do this.
The code to reselect the item looks like this:
For i = 0 to MyList.ListCount - 1
If MyList.column(0,i) = NameID then MyList.selected(i) = True
next i
When I see the list, the item in question is indeed highlighted, but there
is a dotted box around the first item in the list.
If I then try to extract information about the selected item using
msgbox MyList.column(0)
I get an error that says "Invalid use of Null", which means it is not
actually addressing the highlighted record. If I then click on the record,
then everything works fine.
I have multiselect set to Extended if that makes any difference.
Can someone explain what is going on here and the best way to get around it?
Thanks...