How to deselect on a Microsoft Access listbox?

I'm having trouble deselecting a simple listbox with the following code:  Can someone help me with the proper syntax?  Here is the complete sub routine.  The code was taken from an earlier post:  http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_23040790.html  - None of the other suggestions has worked for me as well.

Private Sub cmdAll_Click()
  Dim i As Integer
  For i = 1 To 4
    Me.Controls("txtS" & i) = "*"
  Next
   'deselect all listbox
  With Me.lstDpts
    For i = 0 To .ListCount - 1
        .Selected(i) = False
    Next
  End With
  Me.Refresh
  DoEvents
  txtDpt = "*"
  Call cmdSeek_Click
End Sub
LVL 1
stephenlecomptejrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TextReportCommented:
Have you got this set to MultiSelect? Is not then just set the listbox to NULL.
Cheers, Andrew
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TextReportCommented:
Your code works fine for the deselection in Access 2000, what is the Call cmdSeek_Click doing?
Cheers, Andrew
Option Compare Database
Option Explicit
 
Private Sub cmdSelectAll_Click()
Dim i As Long
 
  With Me.lstEmployees
    For i = 0 To .ListCount - 1
        .Selected(i) = True
    Next
  End With
 
End Sub
 
Private Sub cmdSelectNone_Click()
Dim i As Long
 
  With Me.lstEmployees
    For i = 0 To .ListCount - 1
        .Selected(i) = False
    Next
  End With
 
End Sub

Open in new window

0
stephenlecomptejrAuthor Commented:
Forgot to state Microsoft Access 2003 - sorry.

Multi-select set to None.
0
stephenlecomptejrAuthor Commented:
Thanks for the fast reply!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.