Solved

Behavior entering field

Posted on 2000-02-18
6
341 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now