Results 1 to 4 of 4
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Control "what gets the focus" when a form opens?

    I tried this statement in the OnOpen event, Me.Form.SetFocus, wanting to give focus to the first line of a continuous form. However, the control that gets the focus is the first control in the first line, which of course, triggers the OnGotFocus event for that control. I think it would be something akin to where the focus "lands" when the OnCurrent event fires as one navigates to another record of a continuous form.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    Form cannot get focus when there are active controls. A control gets focus.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    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 GraeagleBill View Post

    ...I tried...wanting to give focus to the first line of a continuous form...

    ...I think it would be something akin to where the focus "lands" when the OnCurrent event fires ...
    First off, a 'line,' which is to say, a Record, never gets Focus; only Controls on the Form gets Focus, unless the Form is devoid of any Controls that may receive Focus, as June7 said; then, and only then, can the Form, itself, receive Focus.

    Secondly, when the OnCurrent event fires, the Focus 'lands' on a Control on the Current Record. If the Current Record is the first Record, when the Form opens, it 'lands' on the Control that is first in the Tab Order for the Detail Section of the Form. For all other Records, the Control that gets Focus, when moving to another Record, is the Control that last had Focus on the previous Record.

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

    All posts/responses based on Access 2003/2007

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Yes, a lesson well learned. Since it was convenient and desirable to give the user an added function with this form, I added a command control to the header section of the form and set the focus to the command control in the form's OnLoad event.

    Thanks for all the help and education about initial focus on continuous forms.

    Bill

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

Similar Threads

  1. Replies: 1
    Last Post: 09-03-2014, 03:27 AM
  2. Replies: 3
    Last Post: 06-06-2013, 08:22 AM
  3. Createobject.Popup Opens With "okay" Box, Access 2007
    By David92595 in forum Programming
    Replies: 3
    Last Post: 01-17-2013, 02:52 PM
  4. Replies: 5
    Last Post: 06-25-2012, 02:06 PM
  5. Replies: 7
    Last Post: 01-29-2012, 07:44 AM

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