View Single Post
  #2  
Old November 5th, 2009, 12:03 AM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Programmatically change combo box sorting

Hi,
you can trap for use of shift key in the key down event. To use the key down
event, you must set the form's Key Preview to Yes.

Here's some sample code ( not for the arrow keys).

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyD And ((Shift And acCtrlMask) 0) Then
MsgBox "Ctrl+D pressed."
End If
End Sub



vbKeyLeft LEFT ARROW key
vbKeyRight RIGHT ARROW key


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



"alt.binaries.cd.genealogy" wrote in message
...
I am looking for a way in Acc2003 to change the sorting of a combo
box, depending if the user holds down the Shift key when clicking the
combo box (i.e. no shift key = sort order (A), shift key down = sort
order (B)).

I have tried changing the combo boxes .RowSource in the On Mouse Down
event (which works) and checking for the Shift key, but this somehow
prevents setting the selected item in the dropdown list. Actually
just setting the existing .RowSource in the On Mouse Down prevents
item selection in the dropdown list.

Any ideas ??