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

    WHAT! Can't move the focus

    I have a form with a command button "cmdDispOp". I click on the command button and code makes a combo box visible and drops it down. User clicks among the choices and I get a 2110 runtime error.

    The dropdown combo:
    Click image for larger version. 

Name:	000.jpg 
Views:	15 
Size:	39.9 KB 
ID:	25511



    The error:
    Click image for larger version. 

Name:	001.jpg 
Views:	15 
Size:	68.0 KB 
ID:	25512





    The combo's onClick event code:
    Click image for larger version. 

Name:	003.jpg 
Views:	15 
Size:	83.2 KB 
ID:	25513



    There was a copy/paste of the command button control earlier in development. Could it be that the control is corrupted?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Why are you using the click event of DispAcct? Is an AfterUpdate event more suitable?

  3. #3
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Should work - unless of course you have disabled or hidden the command button in code you're not showing. I'd add a test command button (from the ribbon, not a copy/paste) to the form and alter the code to select that one. If it works, I'd go with corruption if, as I said, it hasn't been disabled/hidden.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    The user makes a selection from a combo box by clicking. I don't understand how a AfterUpdate fits the user's action.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    The option command button is never referenced in code regarding its visibility, only in OnClick event.

    I will build a new Options command button later this evening and see if it too causes an error.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    If a user is selecting a value, the AfterUpdate event fires first (even if they pick the same value that was showing), then the click event, then the exit event (I don't know if this requires the user to choose a value then select another control or not - just repeating what I've read before). Personally, I don't see the difference based on your post, but maybe ItsMe had a reason for suggesting it. I tested your logic and it worked for me, which is why I surmised the command button may not be able to receive the focus.

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Works fine if I move the same code into an AfterUpdate event procedure. It also works fine if I first set the focus on a different command button first and then immediately set the focus on the Option command button. The latter smells like corruption lurking somewhere. I did re-create the Options command button from "scratch" but that didn't change anything.

    I still contend that the OnClick event should work, but it's hard to argue with success. Thanks ItsMe for that suggestion.

    I have had some strange quirks with A2003 since going to Win 10. I'll be upgrading to 2013 as soon as I learn how to deal with a CommandBar objects needed to replace my right-click popups.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Quote Originally Posted by GraeagleBill View Post
    The user makes a selection from a combo box by clicking. I don't understand how a AfterUpdate fits the user's action.
    FWIW, I always use the after update event. Users can typically type in values as well as select via clicking.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Runtime error 2110, cannot move focus to control
    By sanderson in forum Programming
    Replies: 7
    Last Post: 11-17-2015, 08:00 AM
  2. Replies: 1
    Last Post: 02-21-2015, 11:35 PM
  3. Replies: 3
    Last Post: 12-11-2014, 11:26 AM
  4. Replies: 4
    Last Post: 12-02-2012, 03:14 PM
  5. Move Focus From Subform To Main Form
    By burrina in forum Forms
    Replies: 2
    Last Post: 11-18-2012, 03:09 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