Hi Phucon
Glad it worked for you.
The shift as Integer part o the argument is to ascertain if the Shift, Ctrl or Alt keys were pressed when something was typed.
Here is an example that explains (from MSDN - URL http://msdn.microsoft.com/en-us/library/aa733630(v=vs.60).aspx)
Private Sub Text1_KeyDown(KeyCode As Integer, _ Shift As Integer) ShiftKey = Shift And 7 Select Case ShiftKey Case 1 ' or vbShiftMask Print "You pressed the SHIFT key." Case 2 ' or vbCtrlMask Print "You pressed the CTRL key." Case 4 ' or vbAltMask Print "You pressed the ALT key." Case 3 Print "You pressed both SHIFT and CTRL." Case 5 Print "You pressed both SHIFT and ALT." Case 6 Print "You pressed both CTRL and ALT." Case 7 Print "You pressed SHIFT, CTRL, and ALT." End Select End Sub
regardsRajivOn Fri, Sep 5, 2014 at 7:08 PM, saigonf7q5@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Thanks Rajiv
The NoKeyDown works pretty good. Now I placed the code in a Public module so all combo boxes can call.
I do have a question. What is the 2nd argument (Shift As Integer) for? I left it out and it still works so far. Will that generate errors someday if the argument's omitted?
Phucon
Public Sub NoKeyDown(KeyCode As Integer)
If KeyCode <> vbKeyTab And KeyCode <> vbKeyReturn Then KeyCode = 0
End Sub Private Sub cboSearch_KeyDown(KeyCode As Integer)
Call NoKeyDown(KeyCode)
End Sub
__._,_.___
Posted by: Rajiv <torajiv@gmail.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (24) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar