Select All in Access 2002 List box

  • Thread starter Thread starter Mark Phillipson
  • Start date Start date
M

Mark Phillipson

Hi,

I have a list box that I wish to select all items when the user types
Ctrl+A.

I have tried using the Key Up event but can only seem to trap A not Ctrl+A

Any help would be appreciated....
 
Use the key down event. Setting KeyCode = 0 gulps the keypress into a black
hole

You can use the following code:

Dim iptr As Integer

If KeyCode = Asc("A") And (Shift = acCtrlMask) Then
KeyCode = 0
Beep
For iptr = 0 To Me.List2.ListCount
Me.List2.Selected(iptr) = True
Next iptr
End If

Note that listboxes are zero based. However, if you have the "show heading"
option set for the listbox, then you have to start itpr at 1, and NOT 0.
 
Back
Top