Prevent page down in form

L

lreecher

I have a form with a subform and parent-child relationship on the loan
number. Users will enter data in the subform. All of the fields in the form
are locked as well as the loan number in the subform. I want to prevent users
from being able to page through loan numbers. I know I can prevent scrolling
with the mouse but that doesn't seem to work for paging up or down.
 
J

John W. Vinson

I have a form with a subform and parent-child relationship on the loan
number. Users will enter data in the subform. All of the fields in the form
are locked as well as the loan number in the subform. I want to prevent users
from being able to page through loan numbers. I know I can prevent scrolling
with the mouse but that doesn't seem to work for paging up or down.

Probably the safest method - with the side benefit that your form will be much
more efficient - is to base the Form on a Query which returns only the one
loan number that you want the user to see (perhaps referencing a combo box or
other appropriate control in the form's header, or on a switchboard form).

If the other records aren't in the form's recordsource, there's nothing to
page to!

John W. Vinson [MVP]
 
M

Maurice

Try this:

Form_Keydown(Keycode as Integer, Shift as Integer)
select case KeyCode
case 33,34, 18 --> place keystrokes...
keycode=0
case else
end select
end sub

Quiz: I added three options, pageup, pagedown and tab
Which one is which ;-)
 
B

Brendan Reynolds

Why not use the intrinsic constants, vbKeyPageUp, vbKeyPageDown, and
vbKeyTab?

BTW: according to the object browser, the value of the vbKeyTab constant is
9, not 18. 18 is the value of the vbKeyMenu constant. Just exactly what the
'Menu' key is, I have no idea. Some historical thing retained for backwards
compatibility, perhaps?
 
L

lreecher

I am a little green using VB. The compiler does not like the 'arrow and place
keystrokes'. I am not quite sure what to do about this. Could you please
explain?
Thanks.
 
M

missinglinq via AccessMonster.com

The 'arrow and place keystrokes was put there for your edification; either
remove them or REM them out with an apostrophe

case 33,34, 18 ' --> place keystrokes...
 
M

missinglinq via AccessMonster.com

Brendon is correct, vbKeyPageUp, vbKeyPageDown will work as well as the
keycodes.

What nobody has mentioned is that the Key Preview property of the form has to
be set to YES.

Properties -- Events -- Key Preview
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top