Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Error Problem.......

Author  Topic 

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2002-05-27 : 08:53:08
I have the following code which should untick the ticked row in a list box:


Function Unselect(lst As ListBox)
Dim i As Integer

Screen.ActiveForm.Controls(lst).SetFocus
For Each i In Screen.ActiveControl.ItemsSelected
Screen.ActiveControl.Selected(i) = False
Next
End Function


which is called by: Unselect (lst_Results)

The problem i have is that it seems to pass the value of the selected row in the list box.

e.g.

Row1 is highlighted in the list box but Row1 is bound to a number. It seems to pass the bound number rather than the actual ListBox name ??

The list box name is: lst_Results

Any ideas ?

Paul

RatTail
Crackhead

98 Posts

Posted - 2002-05-27 : 09:18:42
2KnooKie

1)Function Unselect(lst As ListBox????????????????)
We pass in just the control's name not an object itself.
Remove type of variable at all.

2)Dim i As Integer????????????????????????????????
Type of "i" is "Object" or "Variant"

3)I think it's better to call function as: Unselect ("lst_Results")



Go to Top of Page

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2002-05-27 : 09:28:53
Ok many thanks again

It works nicely now

Paul
Go to Top of Page
   

- Advertisement -