Solved

Behavior entering field

Posted on 2000-02-18
6
370 Views
Last Modified: 2012-06-27
I have code that requires the "behavior entering field" param (Tools|Options|Keyboard) to be set to "Select Entire Field". If a user has this set differently, my code will not work.

How can I make sure this setting is how I need it for my code to work properly?
0
Comment
Question by:powermixx
6 Comments
 
LVL 10

Expert Comment

by:paasky
ID: 2535042
Hello powermixx,

You could ensure that running this function in your application startup:

Public Function SetKeyboardOption()
    Application.SetOption "Behavior Entering Field", 0
End Function

Regards,
paasky
0
 

Expert Comment

by:ShoeBooty
ID: 2535375
powermixx,

In regards to paasky's comment, I would suggest that you first evaluate whether or not the option is set properly to begin with.  Then, if it is not, you can use paasky's solution.  Storing the results of this evaluation (yes/no) in a global variable will also enable you to return each users PC to the original configuration when your code is complete.  I have found that this works well to prevent users from complaining that I have changed settings that they have set for their preferences.

Shoe
0
 
LVL 10

Accepted Solution

by:
paasky earned 35 total points
ID: 2535416
Good point ShoeBooty! :-D

The original option value should be read with Application.GetOption method:

Public Function GetKeyboardOption() As Variant
    GetKeyboardOption = Application.GetOption("Behavior Entering Field")
End Function

I also "improved" the SetKeyBoardOption function that it can used to set original value back:

Public Function SetKeyboardOption(OptionValue As Integer)
    Application.SetOption "Behavior Entering Field", OptionValue
End Function

Regards,
Paasky


0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 10

Expert Comment

by:paasky
ID: 2535427
Note: Behavior Entering Field might have value from 0 to 2 (Integer) and they're in the same order as Tools-Options-Keyboard Dialog.
0
 
LVL 10

Expert Comment

by:brewdog
ID: 2535487
Another thought . . . since this is an application-wide setup option (and some users set up there Tools | Options to not select the entire field on purpose) I would think that you would either want to reset the option when you application exits, or if this is for just one field, you could put a

SendKeys "{F2}"

on the Enter event; this toggles Edit mode between highlight and cursor.

brewdog
0
 

Author Comment

by:powermixx
ID: 2558104
Apologies for taking a few days. Works very busy. Thanks Paasky.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question