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