Select all text on entry in a field - can be disabled at application's (or better field) level?

B

Bogdan Zamfir

Hi,

When users TAB to a field, I want it not to select all field content, but
instead go to either begin or end of the field. This because sometimes user
TAB to a field then type something by mistake, by this loosing old content
from the field

I know Access have setting for Behavior setting field, but this seems global
to Access, not to application, so no matter if I change this setting, if I
run app on a PC where Access have this setting as Select Entire field, it
will still select.

I tried with sendkeys left / right arrow, or home / end, but this don't
seems to work.

Any other idea?

Thanks for answers
 
T

Tom Wickerath

Hi Fred,

Neat code sample, but wouldn't this require entering code into the On Got Focus event procedure
for every textbox on every form that you wanted to make sure that the text wasn't fully selected?
How about using the Application.Setoption method, called from a function when the database is
first opened?

Function Startup()
' Call this function at startup when a database is first opened.

Application.SetOption "Behavior Entering Field", 1

End Function


Use 0 for "Select entire field", 1 for "Go to start of field", or 2 for "Go to end of field" as
the argument at the end of the single line of code shown above.

This is based on KB article 216888, titled:
Complete List of Arguments That You Can Use with the GetOption and SetOption Methods
http://support.microsoft.com/?id=216888

Of course, this wouldn't prevent a user from changing the option during their Access session, if
they had access to the Tools > Options settings.

Tom
___________________________________________


Dear Bogdan:

Arvin Meyer has a solution posted as one of the "Ten Tips for Microsoft Access Developers" at the
following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k2/html/odc_actips.asp

Look for the heading: Prevent the Accidental Erasure of Data when Moving between Controls on a
Form

HTH
Fred Boer
___________________________________________


Hi,

When users TAB to a field, I want it not to select all field content, but instead go to either
begin or end of the field. This because sometimes user TAB to a field then type something by
mistake, by this loosing old content from the field

I know Access have setting for Behavior setting field, but this seems global to Access, not to
application, so no matter if I change this setting, if I run app on a PC where Access have this
setting as Select Entire field, it will still select.

I tried with sendkeys left / right arrow, or home / end, but this don't
seems to work.

Any other idea?

Thanks for answers
 
F

Fred Boer

Yes, that is possible, but deciding to *force* changes to global Access
settings against a user's wishes in this way can be problematic. There was a
recent thread in one of these newsgroups that discussed this issue.
Unfortunately, I haven't the time at the moment to look it up...

Sorry to be rushed...
Fred

P.S. And of course, it isn't my code.. It's Arvin Meyer's..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top