Results 1 to 5 of 5
  1. #1
    projectpupil7 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    37

    Red face Set focus when pop up form closes

    Hi, I am trying to set the focus back to page 1 of TabCt186 when pop up form frmEditWorkItem closes on clicking a command button.

    I have been trying with this line of code but keep getting asked for an object required.

    Forms!frmReactiveTracker!TabCtl86.Pages.Item(1).Se tFocus



    Could someone put me right here please.

    Many thanks

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    What is Item(1) and your also put a space in SetFocus
    Try instead:
    Forms!frmReactiveTracker!TabCtl86.Pages(1).SetFocu s

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Code:
    Forms!frmReactiveTracker!TabCtl86.Pages.Item(1).SetFocus
    
    and
    
    Forms!frmReactiveTracker!TabCtl86.Pages(1).SetFocus
    Both forms of the command work for me.

    Is the form frmReactiveTracker open?
    Check spelling of form name and tab control name.....


    Or post your dB for analysis.

  4. #4
    projectpupil7 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    37
    Hi Steve, many thanks for your reply. I am now slightly embarrased as when i copied and pasted your code in to my db it all worked as required. I don't know what the problem might have been as my code and yours look the same. Anyway, all is well now. Thanks again.

  5. #5
    projectpupil7 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    37
    Thanks burrina. i think this is one of those unexplainable issues. ssanfu suggested an answer which worked.

    FYI Item(1) is supposed to represent the tab page number and SetFocus was just a typo or copying error.

    Many thanks for you interest.

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

Similar Threads

  1. Replies: 6
    Last Post: 08-22-2013, 05:35 AM
  2. Replies: 2
    Last Post: 06-19-2013, 05:46 AM
  3. Get Focus on Form after Modal Form closes
    By TinaCa in forum Programming
    Replies: 2
    Last Post: 09-06-2011, 04:47 PM
  4. Form closes after mssage box
    By liam01752 in forum Programming
    Replies: 1
    Last Post: 12-06-2010, 03:30 PM
  5. Change to Form Closes Access
    By jbhjm in forum Forms
    Replies: 5
    Last Post: 04-22-2009, 01:04 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