Question : How to disable page up and page down keys in ms access 97b

Hi,

I am trying to disable the page up and page down keys for a particular form in an access dbase.  The reason is I need to prevent the user from navigating the datasource of the data source for the parent form.After removing recordselectors this can still be done with page up and page down.

Is there a way in VBA to do implement this?

Regards,

-niko

Answer : How to disable page up and page down keys in ms access 97b

yes,


1. In the form property set the keypreview property to [yes].

2. In the form event [KeyDown] catch the [PgUp/Down] keys and do what you want to prevent the key from affecting the form behaviour. Like:

if KeyCode = 34 Then  'PgDown
   KeyCode = 13  'Enter
end if

if KeyCode = 33 Then  'PgUp
   KeyCode = 13  'Enter
end if

3. You can handle such by making the form property [Cyclic] to [current record] or [current page] This will control the record change if user click tab or enter in the last field.

In this way, you should disable the navigation buttons, and treat the arrows keys also.

Regards

Tarek
Random Solutions  
 
programming4us programming4us