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

    Why Combobox gets focus


    Looking at the image below, when the OnClick event fires on the "Image Status" label in the parent form, the results of the code execution includes a RecordSource Requery of the sub-form. How is it that the GotFocus event fires on the combobox you see bound to "FamilyDirFmtID"? There is code in the combo's GotFocus event that ought not execute just because of the sub-forms Requery.
    Click image for larger version. 

Name:	000.jpg 
Views:	11 
Size:	111.1 KB 
ID:	48614

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    What is the TabOrder setting for the 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.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Good thinking, but I'd already wondered that myself. It's at the end of the tab order.
    What I think is happening is that at the time I click on any of the parent controls, that result in a Requery of the sub-form, AND the combo box currently has the focus that the GotFocus of the combo fires again after the sub-form "re loads". I'll try setting the focus elsewhere when the sub-form loads and post back.

    EDIT:
    Okay, I just had to move the focus off the combo BEFORE any actions effecting the sub-form's RecordSource.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,943
    Well you could always walk through the code to see if that is the case, but then I would have thought it would be called HasFocus?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 8
    Last Post: 08-23-2019, 07:19 PM
  2. Replies: 5
    Last Post: 10-18-2016, 06:00 AM
  3. Focus combobox
    By Intruder1500 in forum Programming
    Replies: 18
    Last Post: 01-02-2014, 02:30 PM
  4. Replies: 1
    Last Post: 07-30-2013, 07:18 AM
  5. Replies: 0
    Last Post: 02-22-2011, 04:18 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