Grosraymond
New member
- Local time
- Today, 04:37
- Joined
- Mar 30, 2012
- Messages
- 4
Hello,
I try to select by the vba code, one element in a list box.
I found this code on this site:
It works great, the selection is made. The problem is that once I played this code, I can not use any control on the form. The buttons on the form became inactive
Someone has an idea cause i'm lost, i don't find a solution.
Thank you.
P.S: I use Access 2003
I try to select by the vba code, one element in a list box.
I found this code on this site:
Code:
[COLOR=#0000ff]Function[/COLOR] Selectionner(Liste [COLOR=#0000ff]As[/COLOR] ListBox, Colonne [COLOR=#0000ff]As[/COLOR] [COLOR=#0000ff]Integer[/COLOR], Chercher [COLOR=#0000ff]As[/COLOR] [COLOR=#0000ff]String[/COLOR])
[COLOR=#0000ff]Dim[/COLOR] i [COLOR=#0000ff]As[/COLOR] [COLOR=#0000ff]Integer[/COLOR] [COLOR=#0000ff]
Dim[/COLOR] Trouve [COLOR=#0000ff]As[/COLOR] [COLOR=#0000ff]Boolean[/COLOR] [COLOR=#0000ff]
For[/COLOR] i = [COLOR=#cc66cc]0[/COLOR] [COLOR=#0000ff]To[/COLOR] Liste.ListCount - [COLOR=#cc66cc]1[/COLOR] [COLOR=#0000ff]
If[/COLOR] Liste.Column(Colonne, i) = Chercher [COLOR=#0000ff]And[/COLOR] [COLOR=#0000ff]Not[/COLOR] Trouve [COLOR=#0000ff]Then[/COLOR]
Liste.Selected(i) = [COLOR=#0000ff]True[/COLOR]
[COLOR=#0000ff]If[/COLOR] Liste.MultiSelect = [COLOR=#cc66cc]0[/COLOR] [COLOR=#0000ff]Then[/COLOR] Trouve = [COLOR=#0000ff]True[/COLOR]
[COLOR=#0000ff]Else[/COLOR] Liste.Selected(i) = [COLOR=#0000ff]False[/COLOR]
[COLOR=#0000ff]End[/COLOR] [COLOR=#0000ff]If[/COLOR]
[COLOR=#0000ff]Next[/COLOR] i
[COLOR=#0000ff]End[/COLOR] [COLOR=#0000ff]Function
[/COLOR]
Someone has an idea cause i'm lost, i don't find a solution.
Thank you.
P.S: I use Access 2003