Solved

Behavior entering field

Posted on 2000-02-18
6
333 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

760 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

19 Experts available now in Live!

Get 1:1 Help Now