Solved

Behavior entering field

Posted on 2000-02-18
6
349 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

776 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