• Change Keyboard Behavior for a Form (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Change Keyboard Behavior for a Form (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Author
    Topic
    #449654

    Currently my Options.., Keyboard, Behavior entering field, is set to Select entire field.

    Is there a way in code when a particular form is opened to change this behavior to Go to end of field for all fields on the form without having to handle each field individually like I am now with something like On_Enter set to Screen.ActiveControl.SelStart = Screen.ActiveControl.SelLength?

    Thanks, John

    Viewing 0 reply threads
    Author
    Replies
    • #1103045

      You could use the following code in the form module:

      Above all Subs and Functions:

      Private intOpt As Integer

      Anywhere below that:

      Private Sub Form_Activate()
      intOpt = GetOption("Behavior Entering Field")
      SetOption "Behavior Entering Field", 2
      End Sub

      Private Sub Form_Deactivate()
      SetOption "Behavior Entering Field", intOpt
      End Sub

      This code sets Behavior entering field to End of field when the form is activated, and resets the default setting when the form is deactivated.

      • #1103050

        I like that, opens up a lot of possibilities!

        Thanks, John

      • #1128867

        This procedure is something I would like to use. Is there a reason why this technique will not work with Access97?

        Thank you,
        Ron

        • #1128874

          If I remember correctly, this code would also work in Access 97.

          • #1128890

            For some reason the code does not change the keyboard options as desired. I even made a copy and converted the database to A2K and it will not make the changes there either. Any other ideas?

            Thank you.
            Ron

            • #1128892

              Sorry, no. It works for me in Access 2002 and 2003, and I can’t easily test in Access 97 any more.

            • #1129233

              The code that you have works just fine in 97 and 02 – – – when the form is not popup or modal. blush
              brickwall

              Thanks again
              Ron

            • #1129236

              The On Activate and On Deactivate events do not occur for a popup form, so the code will not work for a popup form.

              The events do occur for a modal form though, so the code should work for a form that is modal but not popup…

            • #1129239

              The popup form was the culprit. Thanks again!

              Ron

            • #1129240

              You could use the On Load and On Close events of a popup form. The disadvantage is that the option won’t be reset when the user clicks away from the popup form. But if the form is popup AND modal, the user can’t do that, so using the On Load and On Close events is sufficient.

            • #1129247

              Thank you for the additional information.

              Ron

    Viewing 0 reply threads
    Reply To: Change Keyboard Behavior for a Form (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: