Results 1 to 8 of 8
  1. #1
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60

    Select contents of a field on click?

    Is it possible to set a property for a field on a form so that either the contents are selected, or the contents are cleared completely, when the field is clicked on (or "clicked into", or given focus...)?



    My data entry is very slow when I have to hit delete several times before I am able to input an expense.

    Many thanks!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I believe that is the default action when you tab into a control but
    Me.ControlName.SelLength = Len(Me.ControlName)
    should also select everything in a TextBox. Using *your* Controlname of course - and the Enter Event is a good place to put this code.

  3. #3
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Thank you for the reply - and this is probably an extremely ridiculous question - but when you say "Me", as in "Me.ControlName.SelLength" - does it actually mean something in Access or is that like a generic term for "Current Form" or something?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    Allan is probably asleep by now. "Me" is used in Access to refer to the object containing the code. In your example here, it would refer to the form. It's a shorter method than the full form reference of:

    Forms!FormName.ControlName

    It's also useful because as soon as you type "Me." Intellisense will provide a list of most of the available objects and methods.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Ah! Very cool!

    Thank you much guys!

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    So are you ready to use the Thread Tools and mark this thread as Solved?

  7. #7
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Thought I already did!
    I saw the check that means "posted by OP" and thought it was already marked solved.

    Oopsy.


  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks! Now we are up to date.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 01-12-2011, 08:59 AM
  2. VBA to update field contents...Error 91
    By jpkeller55 in forum Access
    Replies: 9
    Last Post: 10-11-2010, 07:52 PM
  3. Replies: 2
    Last Post: 08-07-2010, 04:06 PM
  4. Field Select
    By RaptureReady in forum Forms
    Replies: 1
    Last Post: 01-28-2010, 08:29 PM
  5. Remove contents from each field
    By nancyszn in forum Access
    Replies: 7
    Last Post: 08-06-2009, 03:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums