Ms Access Error 2474
soon) Ruby (coming soon) Getting Started Code Samples Resources Patterns and Practices App Registration Tool Events Podcasts Training API Sandbox Videos Documentation Office Add-ins Office Add-in Availability Office Add-ins Changelog Microsoft Graph API Office 365 Connectors Office 365 REST APIs SharePoint Add-ins Office UI Fabric Submit to the Office Store All Documentation https://www.yammer.com/ http://feeds.feedburner.com/office/fmNx Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: Who has the focus? Microsoft Office for Developers > Access for Developers Question 0 Sign in to vote How can I tell which control on an Access 2007form has the focus? Or, if a particular control has the focus? Thanx, DarrellDarrell H Burns Thursday, June 16, 2011 3:15 PM Reply | Quote Answers 0 Sign in to vote Darrell Use Screen.ActiveControl Example: Dim ctrl As Control Set ctrl = Screen.ActiveControl Bill Mosca http://www.thatlldoit.com http://tech.groups.yahoo.com/group/MS_Access_Professionals Marked as answer by DarrellDoesData Thursday, June 16, 2011 3:32 PM Thursday, June 16, 2011 3:25 PM Reply | Quote All replies 0 Sign in to vote Darrell Use Screen.ActiveControl Example: Dim ctrl As Control Set ctrl = Screen.ActiveControl Bill Mosca http://www.thatlldoit.com http://tech.groups.yahoo.com/group/MS_Access_Professionals Marked as answer by DarrellDoesData Thursday, June 16, 2011 3:32 PM Thursday, June 16, 2011 3:25 PM Reply | Quote 1 Sign in to vote http://msdn.microsoft.com/en-us/library/ff845144.aspxAndrey V Artemyev | Saint-Petersburg, Russia Thursday, June 16, 2011 3:28 PM Reply | Quote 0 Sign in to vote Doh! I forgot about that. Thanx Bill!Darrell H Burns Thursday, June 16, 2011 3:37 PM Reply | Quote 0 Sign in to vote I just encountered a runtimeerror using the screen.acti
FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk With Other Members Be Notified Of ResponsesTo Your Posts Keyword Search One-Click Access To YourFavorite Forums Automated SignaturesOn Your Posts Best Of All, It's Free! Join Us! *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting Policies Jobs Jobs from Indeed What: Where: jobs by Link To This Forum! Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.Just copy https://social.msdn.microsoft.com/Forums/office/en-US/a137aeaa-17c8-4686-8714-94a3831ad1c9/who-has-the-focus?forum=accessdev and paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. Microsoft: Access Forms Forum at Tek-Tips HomeForumsProgrammersDBMS PackagesMicrosoft: Access Forms Forum VBA - Problems setting the focus back to the active control thread702-403709 Forum Search FAQs Links MVPs VBA - Problems setting the focus back to the active control VBA - Problems setting the focus back to the active control Custom24 (Programmer) (OP) http://www.tek-tips.com/viewthread.cfm?qid=403709 12 Nov 02 10:49 HelloI have a form in Access 97 and one of the events I have handled is the form_current event (when the current record changes)One thing I did was to check the value of some bound text boxes to do some stuff, and for this I had to set the focus to each text box before I could check its value (or so Access said, anyway)I had intended to reset the focus back to what it was before I did this using this procedure.Private Sub Form_Current()Dim ctl As Controlset ctl = Me.ActiveControl...'do stuff which means moving the focus...'reset the focusctl.SetFocusEnd SubThe problem I have is that Access complains that "Run Time Error 2474The expression you entered requires the control to be in the active window"on the line "set ctl = me.ActiveControl"Why is it having a problem with this.I could understand this happening when the form is opened, and I can just ignore the error with on error resume next, but it happens every time I move the current record.Any ideas?ThanksMark Mark RE: VBA - Problems setting the focus back to the active control GKProgrammer (Programmer) 12 Nov 02 11:37 Hi Mark,You wouldn't happen to be
Ask a Question Need help? Post your question and get tips & solutions from a https://bytes.com/topic/access/answers/949362-run-time-error-2474-when-form-unload-cancel-true community of 418,595 IT Pros & Developers. It's quick & easy. Run Time Error 2474 when Form Unload Cancel = True P: 68 time2hike Hi, I have a http://www.pcreview.co.uk/threads/using-screen-activecontrol-in-form_current-vba-code.3543715/ command button on my form that Closes the form and sends the user to another form Expand|Select|Wrap|Line Numbers PrivateSubcmdGoToClientlkup_Click() 'CloseForm DoCmd.Close 'returnfocustoClientLookupform DoCmd.OpenForm"frm_ClientLkup",acNormal,,,acFormEdit,acWindowNormal On the original form that ms access I am closing I have code in the Form Unload to see if there is crucial information missing that the user may want to fix before closing the form Expand|Select|Wrap|Line Numbers 'ChecksthatallRelationshipshavebeenupdatedfrompreviously Ifrs![RcdCount]<>0Then IfMsgBox("FamilyRelationshipsneedtobeupdatedpriortoclosingFamiliesForm"_ &vbCrLf&"Areyouabletofixtherelationshipsnow?"_ ,vbInformation+vbYesNo,"RelationshipsNotUpdated")=vbYesThen Cancel=-1 EndIf EndIf I am getting the result I want when the user clicks no on the message box the ms access error form closes and the focus returns to the Client Lookup form. When the user clicks yes the form does not close. This is what I want to happen. The problem is when the user clicks yes the first code "cmdGoToClientlkup_Click" is still trying to fire and return the focus to the client lookup form. I am getting the Run Time Error 2474 The expression you entered requires the control to be in the active window. Is there a way I can stop the code in cmdGoToClientlkup_Click when I cancel the Unload? or should I ask the Error handler in cmdGoToClientlkup_Click to ignore Error number 2474? Is there another way to solve this? Thanks for your help! May 11 '13 #1 Post Reply Share this Question 1 Reply Expert Mod 2.5K+ P: 4,994 zmbd Usually 2474 errors are due to the form that you are working with has lost focus. Set focus back to the form and then try the remaining code. May 13 '13 #2 reply Mes
HI I am trying to use the screen.activecontrol command in the Form_current sub in order to collect the name of the textbox the cursor was last in before the record changed. Everytime i try and use this command i get the error message 'Run-time error 2474. The expression you entered requires the control to be in the active window'. I only have the one window open and i am not running it in debug mode. I have also tried using screen.previouscontrol but this keeps returning a Null value. Please help!! Let me know if you need more details. Thanks Paul pgilbert11, Jun 18, 2008 #1 Advertisements Marshall Barton Guest pgilbert11 wrote: >I am trying to use the screen.activecontrol command in the Form_current sub >in order to collect the name of the textbox the cursor was last in before the >record changed. > >Everytime i try and use this command i get the error message 'Run-time error >2474. The expression you entered requires the control to be in the active >window'. > >I only have the one window open and i am not running it in debug mode. >I have also tried using screen.previouscontrol but this keeps returning a >Null value. Whenever possible, you should use Me.ActiveControl instead of Screen.ActiveControl. There may also be an issue about there not being an active control the first time the Current event is triggered (when the form is opening). If so, try trapping and ignoring the error. -- Marsh MVP [MS Access] Marshall Barton, Jun 18, 2008 #2 Advertisements pgilbert11 Guest "Marshall Barton" wrote: > pgilbert11 wrote: > >I am trying to use the screen.activecontrol command in the Form_current sub > >in order to collect the name of the textbox the cursor was last in before the > >record changed. > > > >Everytime i try and use this command i get the error message 'Run-time error > >2474. The expression you entered requires the control to be in the active > >window'. > > > >I only have the one window open and i am not running it in debug mode. > >I have also tried using screen.previouscontrol but this keeps returning a > >Null value. > > > Whenever possible, you should use Me.ActiveControl instead > of Screen.ActiveControl. > > There may also be an issue about there not being an active > control the first time the Current event is triggered (when > the form is opening). If so, try trapping and ignoring the > error. > > -- > Marsh > MVP [MS Access] > Hi Tried changing to Me.ActiveControl and ign