default keypress

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • seeker52

    default keypress

    How can the default functionality built into access by Microsoft be
    turned off. For instance, when I hit the enter key on a form focus is
    set to the next tab stop. How can I hit enter and that not happen?
    Or how can I use the insert key and not be put into overwrite mode. I
    would like to be able to do this via code structure and not via a
    macro. Thank you.

    seeker52
  • Mike MacSween

    #2
    Re: default keypress

    Tools/Options/Keyboard

    Then for each control Properties/Other/Enter Key behaviour.

    Not sure how to alter the behaviour of the insert key. That's what it's for.

    Mike


    "seeker52" <akinfam@hotmai l.com> wrote in message
    news:8c9f7d3a.0 402152101.36ee8 261@posting.goo gle.com...[color=blue]
    > How can the default functionality built into access by Microsoft be
    > turned off. For instance, when I hit the enter key on a form focus is
    > set to the next tab stop. How can I hit enter and that not happen?
    > Or how can I use the insert key and not be put into overwrite mode. I
    > would like to be able to do this via code structure and not via a
    > macro. Thank you.
    >
    > seeker52[/color]


    Comment

    • Lyle Fairfield

      #3
      Re: default keypress

      akinfam@hotmail .com (seeker52) wrote in news:8c9f7d3a.0 402152101.36ee8 261
      @posting.google .com:
      [color=blue]
      > How can the default functionality built into access by Microsoft be
      > turned off. For instance, when I hit the enter key on a form focus is
      > set to the next tab stop. How can I hit enter and that not happen?
      > Or how can I use the insert key and not be put into overwrite mode. I
      > would like to be able to do this via code structure and not via a
      > macro. Thank you.[/color]

      Private Sub Form_KeyDown(Ke yCode As Integer, Shift As Integer)
      Select Case KeyCode
      Case vbKeyReturn
      ' do your thing or do nothing
      KeyCode = 0
      Case vbKeyInsert
      'do your thing
      KeyCode = 0
      End Select
      End Sub

      Depending upon your needs, you may have to write this kind of procedure for
      individual controls.

      --
      Lyle
      (for e-mail refer to http://ffdba.com/contacts.htm)

      Comment

      • Fletcher Arnold

        #4
        Re: default keypress

        "seeker52" <akinfam@hotmai l.com> wrote in message
        news:8c9f7d3a.0 402152101.36ee8 261@posting.goo gle.com...[color=blue]
        > How can the default functionality built into access by Microsoft be
        > turned off. For instance, when I hit the enter key on a form focus is
        > set to the next tab stop. How can I hit enter and that not happen?
        > Or how can I use the insert key and not be put into overwrite mode. I
        > would like to be able to do this via code structure and not via a
        > macro. Thank you.
        >
        > seeker52[/color]


        Set the KeyPreview property of the form to True (in the Event tab of form's
        properties). Then put code into the form's KeyDown event. This means you
        can handle this event before the textbox ever sees the keystroke. Although,
        altering standard behaviour of the enter key might come under the category
        of 'annoying and unexpected' - see Case vbKeyA below:


        Private Sub Form_KeyDown(Ke yCode As Integer, Shift As Integer)

        Select Case KeyCode

        Case vbKeyInsert
        ' Cancel it
        KeyCode = 0

        Case vbKeyReturn
        ' Cancel it
        KeyCode = 0

        Case vbKeyA
        ' Do soemthing annoying and unexpected
        KeyCode = vbKeyB

        End Select

        End Sub


        Fletcher


        Comment

        Working...