Refreshing a ListBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This code successfully highlights an item in a ListBox.

But hwne the code in the Public lstCategory_AfterUpdate event fires off
lstCategory has a value of "Null" rather than the value of the highlighted
item.

Does anyone know what I'm doing wrong?

Any comments would be appreciated.


Set rsRecordset = CodeDb.OpenRecordset( _
"SELECT bytCategory" & _
" FROM tblGraphOptionsSelected_Category" & _
" WHERE intOperator = " & gintCurrentOperatorID, dbOpenSnapshot)

With Forms("frmSwitchboard_Main")
If Not rsRecordset.EOF Then
For intItem = 0 To
..sfrmGraphs.Form.sfrmGraphOptions.Form.lstCategory.ListCount - 1
If
Val(.sfrmGraphs.Form.sfrmGraphOptions.Form.lstCategory.ItemData(intItem)) =
rsRecordset!bytCategory Then

..sfrmGraphs.Form.sfrmGraphOptions.Form.lstCategory.Selected(intItem) = True
End If
Next
.sfrmGraphs.Form.sfrmGraphOptions.Form.lstCategory_AfterUpdate
End If
End With
 
What happens if you try

If Not rsRecordset.EOF Then
Forms("frmSwitchboard_Main").sfrmGraphs.Form.sfrmGraphOptions.Form.lstCategory
= rsRecordset!bytCategory
End If

instead of what you've got in the With Forms("frmSwitchboard_Main")...End
With construct?
 
Problem solved ... it not being MultiSelect, Select Case lstCategory worked
fine when lstCategory_AfterUpdate executed following actual selection of a
list item using the mouse but not when the code fired after highlighting an
item using my code ... I wrote a little For X = 0 to lstCategory.ListCount -
1 loop to populate a variable (bytCategory) and then Select Case bytCategory
worked fine ... thanks anyway ...
 
Back
Top