[AccessD] Key Preview Problem

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Thu Mar 16 10:08:41 CST 2006


In my case the tabs are so 'feature rich' (to use a Microsoft phrase) 
that there's no one starting point on any tab page. It's mostly editing 
and not new records. In fact, the user didn't even ask for this.  I'm 
just a mousophobe so I always try to make my apps so they can be run 
from the keyboard as much as possible.

Rocky


Penn White wrote:
>> I suppose I could set the KeyPreview to true on all the sub forms but
>> then they'd also have to have a copy of the KeyDown routine as well, no?
>>     
>
> Congratulations!!
>
> I also got it working by copying the KeyDown sub to the subform control that 
> gets the focus when you go to the tabbed page.  It didn't work when I used 
> the KeyDown event for the subform itself.  I like your way but I also like 
> having the user end up in the correct first control on the form for data 
> entry.  If they hit Tab or Enter when the focus is on the Exit button, I'm 
> not sure where the cursor would go to.  I'm also not sure the KeyCode=0 is 
> necessary but I haven't tested it.
>
> I also use this for PgUp and PgDn to go to the next main record because when 
> you're in a subform, as you know, it just tries to go to the next record in 
> the subform and really gets screwed up.
>
> Private Sub FullName_KeyDown(KeyCode As Integer, Shift As Integer)
>   Dim intAltDown As Integer
>     intAltDown = (Shift And acAltMask) > 0
>     If intAltDown Then
>       Select Case KeyCode
>         Case 76 ' L
>           Me.Parent.Pg1.SetFocus
>           KeyCode = 0
>         Case 78 ' N
>           Me.Parent.Pg2.SetFocus
>           KeyCode = 0
>         Case 68 ' D
>           Me.Parent.Pg3.SetFocus
>           KeyCode = 0
>         Case 83
>           Me.Parent.Pg4.SetFocus
>           KeyCode = 0
>       End Select
>     End If
> End Sub
>
> Penn 
>
>   

-- 
Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com




More information about the AccessD mailing list