Results 1 to 9 of 9
  1. #1
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727

    Tab Stop in forms


    I have a few menu forms that contain only buttons to open other forms. I set all the tab stop properties to No. However, I noticed that the button that has the first tab stop of 0, is the button that has the focus when the form opens. This is not good in case the user accidentally presses the Enter button on the keyboard, it will automatically click this first tab stop button on the form. Does anyone know how to prevent this from happening?

  2. #2
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Hi ,data
    use the code
    Private Sub Form_Current()
    Command1.SetFocus
    End Sub

  3. #3
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    Wouldn't this code make the next button get the focus? I don't want any buttons to have the focus just in case the user presses Enter on the keyboard. Let me know if I am wrong and this code is in fact what I want it to do.

    Thanks so much for the help.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I think you'll have to fool the Access Gnomes to do this!

    In Form Design View

    1. Create a Textbox
    2. Name it FauxControl
    3. Move it up to the Top/Left of the Detail Section
    4. Delete the attached Label (if any)
    5. With the Textbox selected, hold <Shift> down and use the Up and Left Arrows to reduce it to a pinpoint

    Now, place this code in the Form's Code Module:

    Code:
    Private Sub Form_Load()
     FauxControl.SetFocus
    End Sub

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Very nice
    Missinglinq
    Ha ha you are actually deceitful

  6. #6
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    I actually did this before but considered it to be pretty ghetto. I was just wondering if access had a traditional feature to prevent this from happening. Thanks anyway.

  7. #7
    MarvinM's Avatar
    MarvinM is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Posts
    30
    I don't know of any other way. When the form is opened, and becomes "Current", something needs to have focus. If there are data entry fields, I always go with the first one I want the user to enter data into. If it is just a menu screen, with all buttons, I will set the focus on the "Exit" button. That way if the user accidentally hits the Enter key, no harm, they just have the form close and they wonder how they did that. Then they have to reopen the form. It doesn't take long for them to learn not to accidentally hit the Enter key anymore.

    This combines safety for your form with some behaviour modification training for your users. A win-win!

  8. #8
    data808 is offline Noob
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    727
    Whats funny is That idea did cross my mind as well but I think I like the trick of making a pin sized text box and setting focus to that. You can't even see the text box its so small. Anyway, thanks everyone for all the suggestions. You guys are awesome.

  9. #9
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by data808 View Post

    ...You can't even see the text box its so small...
    That's correct...it's too small to be detected by the human eye!

    Once again, glad we could help!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 2
    Last Post: 11-14-2013, 06:04 PM
  2. Replies: 3
    Last Post: 08-19-2013, 01:23 PM
  3. Replies: 3
    Last Post: 12-12-2012, 01:13 AM
  4. Stop auto save of forms
    By shanky365 in forum Forms
    Replies: 2
    Last Post: 07-28-2011, 08:37 AM
  5. Replies: 2
    Last Post: 11-29-2009, 12:00 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