Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations danielledunham on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I disable page up and page down keys?

Status
Not open for further replies.

johngordon

Technical User
Joined
Jun 29, 2002
Messages
112
Location
US
Greetings,

I have created buttons to allow me to scroll through my records (first, back, next and last).

I want to disable the page up and page down keys, so the buttons must be used to scroll through records. Can someone help me and explain how this is done.

Also if I'm on the last record in the db and I press the next button a new record number is be added. How in the world do I stop that from happening?

Many thanks,

John
 
Firstly, this is not as easy as it seems. A wheel mouse will also scroll through the records.

To disable the pg up & pg down buttons do the following:

On the forms load event add:

Me.KeyPreview.Enabled = True

Then the following:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case 33, 34
KeyCode = 0
End Select

End Sub

For a complete solution this may help
 
Thanks, worked like a charm!!!

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top