Results 1 to 8 of 8
  1. #1
    AntelopeOne is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    8

    SetFocus to header field when form opens

    I've found a few different suggestions on how to do this, but no luck so far.



    I'm trying to set the focus of a form to a search field in the header.






    When I save, close, and re-open the form...



    Please excuse my ignorance, I'm starting to bother myself, so I can imagine how you veterans feel

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Is the control's TabOrder property set to 0?
    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
    AntelopeOne is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    8
    Looks like it, unless I'm looking at the wrong object.


  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you are trying to attach images, they are not showing for me.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  5. #5
    AntelopeOne is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    8
    That's no good...did the images in the OP show?

    Regardless, I attached a copy of my db.

    DBSearchTestCopy.zip

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    They do not show.

    Looks like I did have to deal with this issue at some time. Apparently my solution was to set the Detail section not Visible and then have code make it visible after selection in combobox.
    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.

  7. #7
    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 can't open a v2010 file, but here are a few things to consider:

    • This type of error, usually but not associated with opening a Form, is apparently caused by all kinds of things, and, to the best of my knowledge, it is very seldom, if ever, actually connected with communicating with a OLE server or ActiveX Control, nor is it ever caused by the possible reasons given by the message!

      The most common cause, going by what I've seen online for the past ten years, has to do with using a non-English language with Access, and the need to set the language for non-unicode programs to that foreign language. Is this the case, here? If so, here's a link explaining this:

      You receive an error message when you start Visual Basic for Applications code in an Access database

      Note that although this link gives a specific Version of Windows and/or Access, the same problems have persisted over all combinations of Access and Windows.

    • The Tab Order doesn't really matter; each Section has its own Tab Order, and by default, when opening a Form, the Focus goes to the Detail Section

    • The original code Me.txtSerialSearch.SetFocus is valid and should work, so it's possible that the Control is corrupted; you might try deleting it then re-creating it

    • And always a possible solution, when things suddenly go phooey, is to create a new, blank Access file and Import everything into it. This would be the first thing that I would do.


    Linq ;0)>

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    All good points. So I just tested this code with a new textbox and it works. Now have to get to office and find out why it wasn't working in other db.

    Okay, it does work in the other form. Don't know what I was doing wrong the other day. Now remember my solution of not showing the Detail section is because I simply don't want it to show until selection in combobox.
    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.

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

Similar Threads

  1. SetFocus on Field in subform
    By quicova in forum Forms
    Replies: 5
    Last Post: 09-20-2013, 04:10 PM
  2. Replies: 2
    Last Post: 06-25-2012, 08:30 PM
  3. Replies: 7
    Last Post: 01-29-2012, 07:44 AM
  4. Error checking field, SetFocus does not work
    By SemiAuto40 in forum Access
    Replies: 9
    Last Post: 07-26-2011, 10:08 AM
  5. Replies: 1
    Last Post: 07-14-2011, 05: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