Results 1 to 5 of 5
  1. #1
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149

    Runtime error 2110 cannot move focus to textbox control

    i have a textbox IssueDate for date field.


    it is enabled=true, visible=true, locked=false, Tab Index=0, Tab Stop=Yes
    when i run below code, it gets error 2110, cannot move focus to that control
    Code:
    Me.IssueDate.SetFocus
    Thanks.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    Quote Originally Posted by uoghk View Post
    i have a textbox IssueDate for date field.
    it is enabled=true, visible=true, locked=false, Tab Index=0, Tab Stop=Yes
    when i run below code, it gets error 2110, cannot move focus to that control
    Code:
    Me.IssueDate.SetFocus
    Do you have any code that changes those property settings, perhaps in the forms Load or Open events?

    Which event is your SetFocus code in?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    No code to change this control property.
    This SetFocus action is in Form_Open.
    When in debug mode, it shows the 2110 error and stop on Me.IssueDate.SetFocus line.
    But when I press F8, it can pass through and run the rest of coding.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,418
    A - I presume the control is either unbound or bind to a editable field?

    B - what is the tab Order for the control- if it is the first one it already has the focus so setting it again can cause an error

    C - the form open event is probably too soon to be setting focus as the controls have not yet been populated - try the current event

  5. #5
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    Thanks Ajax.
    I put the code to Form_Current, then it works.
    I also test to set the Tab Order to value other than 0, it will also receive 2110 error.

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. runtime error '2110'
    By pbouk in forum Forms
    Replies: 8
    Last Post: 03-13-2014, 02:43 PM
  3. Set Focus causes RunTime Error 2108
    By ResearchRN in forum Programming
    Replies: 8
    Last Post: 12-12-2012, 08:32 AM
  4. runtime error 2110
    By Mclaren in forum Programming
    Replies: 9
    Last Post: 07-07-2011, 01:02 PM
  5. Replies: 0
    Last Post: 02-22-2011, 04:18 PM

Tags for this Thread

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