Changing View from From to Datasheet in VBA

J

jake

My customers do not like using the View menu to change between the
Form and Datasheet view in Access.

Is there a way to trap keys (like HOME and END) to switch between
formats?

I tried to following but got an error "You can't change to a different
view at this time!"

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If (KeyCode = 36) Then ' pressed HOME
DoCmd.RunCommand acCmdFormView
End If
If (KeyCode = 35) Then ' pressed END
DoCmd.RunCommand acCmdDatasheetView
End If
End Sub
 

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