Results 1 to 6 of 6
  1. #1
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88

    Navigation Form Tab Subforms

    Hello Everyone I hope everyone is staying warm. Can someone help me again on this brain teaser and I know it is something obvious I am missing. I have created a Horizontal Navigation form. That form is named for the sake of this discussion AjaxCo. I have two sub-forms within this navigation form are (Employees) and other named (Clients).



    What I would like to do is as I tab through first tab form (Employees) when I lose focus on field named Spouse. I want to be able to automatically jump to next sub-form within this navigation form which is entitled (Clients) and regain tab focus on first field in (Clients) which is entitled FirstName.

    I have placed the following code in First SubForm (Employees) field Spouse lost focus event

    Private Sub Spouse_LostFocus()
    Me. AjaxCo.SetFocus
    Me. AjaxCo!Clients.SetFocus
    Me. AjaxCo!Clients.Form! FirstName.SetFocus
    End Sub

    However, it is not triggering the desired response and getting errors. Does anyone have any ideas? I hope I explained it well. Once again like always Thanks everyone for their help and expertise I really appreciate it.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    I think you may need to use Parent instead of Me
    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
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    I have two sub-forms within this navigation form are (Employees) and other named (Clients)
    I think you have one subform control and as you click on the tab you navigate to the selected form as is common with navigation form. Follow the code below -
    navigationform is main form,NavigationSubform is subform control on it. Form3 is one of the forms on main form having field to which you wish to set focus
    Code:
    Private Sub Text4_LostFocus()
    Forms!navigationform!NavigationSubform.SourceObject = "Form3"
    Forms!navigationform!NavigationSubform.SetFocus
    Forms!navigationform!NavigationSubform!Text0.SetFocus
    End Sub

  4. #4
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88
    Thanks everyone for the help, however, I must be doing something wrong. It throws errors. Using the example scenario provided above I entered it into code that amrut provided. Should the VBA code I use read as follows? If not please show what I am doing wrong if possible. Once again many thanks to everyone.


    Private Sub Spouse_LostFocus()
    Forms!AjaxCo!Employees.SourceObject = "Spouse"
    Forms!AjaxCo!Clients.SetFocus
    Forms!AjaxCo!Clients!FirstName.SetFocus
    End Sub

  5. #5
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Look for the subform control name on your main form and replace the Employees /Clients with it. Is "Spouse" name of a form in your project ? Navigation form is similar to subform. A single subform changes its source object when you click on the respective navigation buttons.
    Attached Files Attached Files

  6. #6
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88
    Thank You Very much Amrut the attached file you did was the perfect explanation. Thank you so much

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

Similar Threads

  1. Replies: 0
    Last Post: 11-26-2014, 06:02 AM
  2. Replies: 1
    Last Post: 11-18-2014, 12:35 PM
  3. Replies: 5
    Last Post: 11-04-2014, 08:13 AM
  4. Replies: 12
    Last Post: 10-23-2014, 02:08 AM
  5. Replies: 24
    Last Post: 03-04-2013, 06:15 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