Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71

    How to setfocus on a tab from subform on another tab

    I have a mainform called [order list] which I have added two tab pages
    Main form =Order List
    Tab Control =TabControl1
    Page 1 = ViewOrderTab / Order Summary Subform
    page 2= OrderTab / Order Details Subform



    I basically want to be able to double click on Order ID in subform on page 1 and open Page 2 and filter to the order ID selected. I figured if I could get it to open the page I can then filter it.

    But despite best efforts it's not allowing me to setfocus to the page.

    I have tried following with errors

    me.TabControl1=1 [method or data member not found]
    me.parent.TabControl1=1 [method 'parent' of object '_form_Order Summary Subform
    me.Tabcontrol1.value=1 [same as 1]
    me.parent.Tabcontrol.value=1 [same as 2]
    me.TabControl1.ordertab.setfocus [same as 1]
    me.ordertab.setfocus [same as 1]
    forms![order list] variants of the above [Method 'item' of object 'forms' failed]
    also tried with pages index but so far nothing works

    It's strange that everywhere these commands are being referenced but I get errors. Can somebody point me in the right direction to get this to work

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    What is the main form bound to?

    You want the two subforms to be linked and synchronize the records? Review http://www.fmsinc.com/MicrosoftAcces...edSubforms.asp

    Once that works, deal with setting focus issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    seems like this one should have worked
    me.ordertab.setfocus
    if you copied and pasted to your post, it's interesting that there is no capitalization.
    You have listed
    OrderTab at the top, but ordertab below.
    If this is correct, then you probably are not spelling something consistent.
    the other choice is
    forms("main form").
    ordertab.setfocus

  4. #4
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71
    Forms("order list").OrderTab.SetFocus - method of 'item' object 'forms' failed

  5. #5
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71
    June

    I know how to link subforms. I can easily open a new form dialogue to open the correct form in another window but I want to emulate that with tabbed pages if possible

  6. #6
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    I'm doing it both ways I suggested earlier.
    It makes me think there's a spelling difference between your code and the controls.
    Maybe just make a blank form with some tabs with a button that changes focus to a different tab and see if that works.

  7. #7
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71
    Quote Originally Posted by JamesDeckert View Post
    I'm doing it both ways I suggested earlier.
    It makes me think there's a spelling difference between your code and the controls.
    Maybe just make a blank form with some tabs with a button that changes focus to a different tab and see if that works.
    Are you trying with navigation subform as well. Maybe that is the difference. I will try it with blank form.

  8. #8
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71
    works on new blank form
    Forms("form1").Page2.SetFocus

  9. #9
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    I was just testing by putting a button onto a form I already have which has tabs, each with a subform.
    I don't know what you mean by navigation subforms and how would that affect the setfocus?

  10. #10
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71
    doesn't work on form1 as navigation subform. whats wrong

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by JamesDeckert View Post
    ...by navigation subforms...
    Perhaps they are using the Navigation Control.

  12. #12
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71
    navigation subform is when you have a list of buttons that when clicked will display a subform that is bound to each button. sort of like tabs but can only hold subforms and not other controls

  13. #13
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71
    Yes. Navigation Control. Which is referred to as Navigation Subform in the properties

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    I don't like and don't use Navigation Control/Form. What you want might not be possible with it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    saudkazia is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Location
    India
    Posts
    71
    the reason Im using Navigation control is because I want to ensure that all the forms have a uniform theme and window and no windows are overlapping

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. SetFocus on last added form control in subform
    By faythe1215 in forum Forms
    Replies: 12
    Last Post: 03-02-2015, 04:09 PM
  2. Proper Use of SetFocus?
    By rpeare in forum Forms
    Replies: 14
    Last Post: 10-21-2013, 02:58 PM
  3. SetFocus on Field in subform
    By quicova in forum Forms
    Replies: 5
    Last Post: 09-20-2013, 04:10 PM
  4. SetFocus after MsgBox
    By NISMOJim in forum Programming
    Replies: 18
    Last Post: 12-12-2012, 08:44 PM
  5. SetFocus problem
    By JvdP in forum Forms
    Replies: 0
    Last Post: 03-16-2011, 08:55 AM

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