Re: on KEYDOWN ON SET FOCUS
- From: "Michel Walsh" <vanderghast@VirusAreFunnierThanSpam>
- Date: Thu, 9 Jun 2005 11:36:46 -0400
Hi,
Use something like:
=======================
Option Compare Database
Option Explicit
Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
Debug.Print "KeyDown: ", KeyCode, "Ctrl ? ", acCtrlMask = (acCtrlMask
And Shift)
End Sub
Private Sub Text0_KeyPress(KeyAscii As Integer)
Debug.Print "KeyPress: ", KeyAscii
End Sub
Private Sub Text0_KeyUp(KeyCode As Integer, Shift As Integer)
Debug.Print "KeyUp: ", KeyCode, "Ctrl ? ", acCtrlMask = (acCtrlMask And
Shift)
End Sub
========================
and you will observe that Home key generates a KeyDown and a KeyUp, but not
a KeyPress, with 36=KeyCode.
To check the Control or Alternate key, use the relevant Mask as
illustrated, with the second argument send to the event procedure handler.
Hoping it may help,
Vanderghast, Access MVP
"ooxx" <ooxx@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DDEBF45D-922D-4D04-AB27-904229343E0E@xxxxxxxxxxxxxxxx
> THANKS YOUR ADVICEs
> Everything OKEY now,
> But Do you know what 's the keycode of 'end' and 'home'?
>
> And if to use the combination 'alt', code 18, with for example code 38 so
> what should the code be if for example we have shift,code shift =1 with
> code
> 39 will only be like ,,,,
> select case keycode
> case 39 and shift =1
> .........
> .........
> case else
> end select
> what would be 'ALT' and combination with code 39 be?
>
> Thanks
>
>
> "Michel Walsh" wrote:
>
>> Hi,
>>
>>
>> If the control is bound to a field and that the actual data does not
>> pass the field validations (like not allowing NULL, not allowing a
>> negative
>> value, etc.), Access will not like to let you leave the control with its
>> illegal data in it.
>>
>> If you are in a context where you can leave the control, then, no
>> need
>> to use special code, try
>>
>> Me.ControlName.SetFocus
>>
>>
>> in VBA code (which I assume is the environment where your problem arise).
>>
>>
>> Hoping it may help,
>> Vanderghast, Access MVP
>>
>>
>> "ooxx" <ooxx@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:24D73FED-6E21-4521-832A-AB15940B0417@xxxxxxxxxxxxxxxx
>> > JAMWS;
>> >
>> > OH ley,,, leg leg ..
>> > The question is when the control textbox on keydown .. . some codes
>> > can
>> > make the setfocus when typing speicial keycodes like 39 . while on the
>> > other
>> > textbox using the same won't make the same response. MS ACCESS have
>> > errors .
>> >
>> > OKEY if the setfocus won't response can we make it exit to leave to
>> > another
>> > tab order textbox.
>> > WOW WOPP WOPP
>> > THANKS
>>
>>
>>
.
- Follow-Ups:
- Re: on KEYDOWN ON SET FOCUS
- From: ooxx
- Re: on KEYDOWN ON SET FOCUS
- References:
- on KEYDOWN ON SET FOCUS
- From: ooxx
- Re: on KEYDOWN ON SET FOCUS
- From: Michel Walsh
- Re: on KEYDOWN ON SET FOCUS
- From: ooxx
- on KEYDOWN ON SET FOCUS
- Prev by Date: Re: On Current events keep executing over and over again for the same open forms
- Next by Date: Is it possible to create a parameter form?
- Previous by thread: Re: on KEYDOWN ON SET FOCUS
- Next by thread: Re: on KEYDOWN ON SET FOCUS
- Index(es):
Relevant Pages
|