Ms Access Runtime Error 2110
Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools Rating: Display Modes 02-12-2008, 10:31 AM #1 TheFerrisFile Newly Registered User Join Date: Jul 2006 Posts: 16 Thanks: 2 Thanked 0 Times in 0 Posts Run-time error 2110 I am trying to set up my form so that when a button is pressed it changes the value of a hidden combo box to another value. Here is my code so far: On the button Click event procedure: Private Sub bttn_date_Click() Me![ONCLog_DateOut] = Date Me![Status_ID].SetFocus End Sub On the GotFocus event procedure: Private Sub Status_ID_GotFocus() Me![Status_ID] = "2" End Sub When I press the button it returns a Run-time error 2110 "Can't move the focus to Status_ID" I have tried rewriting the code several different ways as I am working in Access 2007 and have found that some of my old tricks don't work in '07. Thanks in advance. TheFerrisFile View Public Profile Find More Posts by TheFerrisFile 02-12-2008, 10:55 AM #2 pbaldy Wino Moderator Join Date: Aug 2003 Location: Nevada, USA Posts: 28,922 Thanks: 6 Thanked 3,236 Times in 3,182 Posts What is status_ID (textbox, label, etc)? Is it visible when the code runs? __________________ Paul Microsoft Access MVP To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. pbaldy View Public Profile Find More Posts by pbaldy 02-12-2008, 11:14 AM #3 TheFerrisFile Newly Registered User Join Date: Jul 2006 Posts: 16 Thanks: 2 Thanked 0 Times in 0 Posts Status_ID is a Combo box that is not visible on the form. I have tried writing some code that makes the combo box visible, then change the value, then back to visible = false. But it still gets caught up on the SetFocus of the button click event procedure. TheFerrisFile View Public Profile Find More Posts by TheFerrisFile 02-12-2008, 11:20 AM #4 gemma-the-husky Super Moderator Join Date: Sep 2006 Location: UK Posts: 13,140 Thanks: 50 Thanked 885 Times in 857 Posts you cant move the focus (setfocus) to a hidden control what do yuo
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MS Access run-time error 2110 up vote 1 down vote favorite I am new here. And I am new to MS Access also. My http://www.access-programmers.co.uk/forums/showthread.php?t=143534 problem is when I click on close button of MS Access the following things happens: I am using vba code to show a message in LostFocus event of User ID textbox. Here is the code Private Sub txtuserid_LostFocus() If Len(txtuserid.Value & nullvalue) = 0 Then MsgBox "You can not leave it blank." txtpswd.SetFocus txtuserid.SetFocus Else txtuserid = txtuserid.Value End If End Sub The messages shows up for 4 times. After that the run-time error comes up http://stackoverflow.com/questions/24829408/ms-access-run-time-error-2110 saying this: Run-time error '2110': Library Systems can't move the focus to the control txtuserid. with "End", "Debug", and "Help" buttons. So my Question is, is there any way of stopping the VBA code on quitting the application or any better method to SetFocus to the desired field. vba access-vba ms-access-2007 runtime-error setfocus share|improve this question edited Jul 18 '14 at 22:30 John Saunders 138k20178323 asked Jul 18 '14 at 16:04 Hasnain Azam Somro 62 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote Try moving your code to the Unload event like this: Private Sub Form_Unload(Cancel As Integer) If Nz(Me.txtuserid, "") = "" Then MsgBox "You can not leave User ID blank." Me.txtuserid.SetFocus Cancel = True End If End Sub Before the form closes, it will check to make sure there is a value in txtuserid. If there isn't, it will throw a message box saying so, set the focus back on it, and cancel the Unload event, leaving the form open. share|improve this answer answered Jul 18 '14 at 22:20 VBlades 1,884146 add a comment| up vote 0 down vote In yourButton_Click Event to make sure something is there when trying to log in: If Len(txtuserid & "") = 0 Then MsgBox "Missing user id" txtuserid.SetFocus Exit Sub End If If Len(txtPassword & "") = 0 Then
Hello Friends, I am facing a strange problem with my access application code. I get the following error message when I try to set focus http://www.pcreview.co.uk/threads/run-time-error-2110-microsoft-access-cant-move-the-focus-to-the-control.1092605/ to a dropdown control on my multitabbed access form. Run-time error '2110': http://www.office-forums.com/threads/run-time-error-2110-microsoft-access-cant-move-the-focus-to-the-control.288720/ Microsoft Access can't move the focus to the control 'ControlName' I have set the dropdown control's visible and enabled property to true before setting focus. Please help. Any suggestions welcome. Regards. Hemil, Aug 10, 2004 #1 Advertisements Ken Snell Guest How are you trying to set focus to that control? ms access More details please. -- Ken Snell
Hemil, Aug 10, 2004. Hemil Guest Hello Friends, I am facing a strange problem with my access application code. I get the following error message when I try to set focus to a dropdown control on my multitabbed access form. Run-time error '2110': Microsoft Access can't move the focus to the control 'ControlName' I have set the dropdown control's visible and enabled property to true before setting focus. Please help. Any suggestions welcome. Regards. Hemil, Aug 10, 2004 #1 Advertisements Ken Snell Guest How are you trying to set focus to that control? More details please. -- Ken Snell