ChrisTheIntern
Registered User.
- Local time
- Today, 12:33
- Joined
- Jul 10, 2015
- Messages
- 24
Hi guys,
I am having trouble triggering the code within the ctl+click case in this code. The code for ctl+A works fine but not for ctl+click.
Can anyone show me the problem here?
I am having trouble triggering the code within the ctl+click case in this code. The code for ctl+A works fine but not for ctl+click.
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'Redefining Hotkeys
'Stop ctl+A from triggering Access hotkey for "select all records"
'Redefine ctl+A to select all text in textbox
Dim ctl As Control 'Active Control
Dim ctlType As Integer
If Shift = 2 Then 'ctl key
Select Case KeyCode
Case vbKeyA 'Case ctl+A
Debug.Print "HI"
Set ctl = Screen.ActiveControl
ctlType = ctl.Properties("ControlType")
If ctlType = acTextBox Then
ctl.SelStart = 0
ctl.SelLength = Len(ctl.Text)
KeyCode = 0 'Stops Access Hotkey ctl+A that selects all records
End If
Case vbKeyLButton 'Case ctl+Click
Debug.Print "If this prints, I will eat my hat"
Set ctl = Screen.ActiveControl
ctlType = ctl.Properties("ControlType")
If ctlType = acListBox Then
ctl.ListIndex = -1
Form.Repaint
End If
End Select
End If
End Sub
Can anyone show me the problem here?