Results 1 to 2 of 2
  1. #1
    reg1965 is offline Novice
    Windows 10 Access 2007
    Join Date
    Mar 2016
    Posts
    2

    subform setfocus but tabbing controls not visible until click on main form

    I have just upgraded to 2007 from 2003 and migrated my latest fully working project to it.



    One form I have has a subform. I have no issues with data fetching/synchronization/persisting. All my other code works as intended.

    The main form is represented by mPayroll, the subform by sfrmDayHours and the first control on the subform by m_txtStartTime.

    I have a pair of navigation buttons (previous/next) on the main form. When these are pressed the click event transfers focus to the subform and the first control on it. All seems well at this stage.

    The problem is is that when I start to navigate through the subform all I get is beeps and the focus appears to stay on the first control. But when I click back anywhere on the main form the focus has indeed moved forward however many times I've hit the tab key and the focus is back in the subform and it works fine. This happens every time I use the main form navigation buttons.

    here is the code for the previous button (next button does the same but for forwards)
    Code:
    Private Sub mbtnPrevious_Click()
        If mDayHours.IsDirty Then
            MsgBox "There are changes that need to be saved.", , MSGBOX_TITLE
        Else
            With mEmployeeList
                .MovePrevious
                
                If .BOF Then
                    .MoveFirst
                    
                    SelectFirstHourField
                Else
                    EmployeeChanged
                End If
            End With
        End If
    End Sub
    The SelectFirstHourField sub is this
    Code:
    Private Sub SelectFirstHourField()
        mPayroll.sfrmDayHours.SetFocus
        m_txtStartTime.SetFocus
    End Sub
    The EmployeeChanged sub is this
    Code:
    Private Sub EmployeeChanged()
        mCurrentEmpNum = mEmployeeList.Fields(EMPLOYEE_EMP_NUM).value
        mtxtEmpName.value = mEmployeeList.Fields(EMPLOYEE_EMP_NAME).value
            
        FetchDayHours
        
        FetchTimesheet
        
        ' alert total hours
        HoursChanged mDayHours.TotalHours
            
        ' first field
        SelectFirstHourField
        
        ' is deleteable?
        mbtnDelete.Enabled = IsDeleteable
    End Sub
    As you can see SelectFirstHourField gets called whatever happens.

    I'm implementing an MVC architecture. There is no code behind any forms. All of the control events are sunk in a controller class module and this works exactly as expected.

    Being new to 2007 I'm wondering if there is some setting I've missed or what!

    Any help here would be most appreciated.
    Steve

  2. #2
    reg1965 is offline Novice
    Windows 10 Access 2007
    Join Date
    Mar 2016
    Posts
    2
    I have recently upgraded to Windows 10 and originally had problems using O2003 but have un-installed 2007 and gone back to 2003 which now, strangely seems to work fine.

    That's Microsoft for you.

    Anyway...thanks for your interest.

    Steve

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

Similar Threads

  1. Lining up controls and main form and subform.
    By Lou_Reed in forum Access
    Replies: 3
    Last Post: 10-01-2015, 01:30 PM
  2. Tabbing through tab controls
    By cowboy in forum Forms
    Replies: 1
    Last Post: 04-30-2012, 12:32 PM
  3. Replies: 3
    Last Post: 03-29-2012, 12:40 PM
  4. Replies: 10
    Last Post: 12-31-2010, 12:35 PM
  5. Replies: 1
    Last Post: 09-28-2009, 05:21 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