T
trevorC via AccessMonster.com
Hi,
I have a main form with two sub forms,
1 employees in attendance
2 special employees in attendance.
I am using the code below for the oncurrent event for subform 2 with extra
code to stop this going off when the form is first loaded.
If i try to use similar code for the employees in attendance subform the code
goes into an endless loop.
What i am trying to do is - If the current record in one sub form changes
then select the same record in the other subform and visa versa.
there is no link between the main and sub forms.
I could use one subform with extra fields but as a user interface it looks a
bit cleaner to seperate this information and this makes it more clear.
All help is appreciated, thanks in advance
Trevor.
Special_Employee = Forms![main menu]![Special Employees]![Special Employees]
In_Attendance = Forms![main menu]![employees at work]![In Attendance]
DoCmd.GoToControl "Employees at work"
DoCmd.GoToControl "In Attendance"
DoCmd.GoToRecord , , acFirst
Dim at_work_list As Recordset
Set at_work_list = Forms![main menu]![employees at work].Form.RecordsetClone
at_work_list.MoveFirst
at_work_list.MoveLast
If at_work_list.RecordCount > 0 Then
at_work_list.MoveFirst
For i = 1 To at_work_list.RecordCount
If In_Attendance = Special_Employee Then
DoCmd.GoToControl "special Employees"
Exit Sub
Else
DoCmd.GoToRecord , , acNext
Special_Employee = Forms![main menu]![employees at work]!
[In Attendance]
End If
Next
End If
DoCmd.GoToControl "special Employees"
End Sub
I have a main form with two sub forms,
1 employees in attendance
2 special employees in attendance.
I am using the code below for the oncurrent event for subform 2 with extra
code to stop this going off when the form is first loaded.
If i try to use similar code for the employees in attendance subform the code
goes into an endless loop.
What i am trying to do is - If the current record in one sub form changes
then select the same record in the other subform and visa versa.
there is no link between the main and sub forms.
I could use one subform with extra fields but as a user interface it looks a
bit cleaner to seperate this information and this makes it more clear.
All help is appreciated, thanks in advance
Trevor.
Special_Employee = Forms![main menu]![Special Employees]![Special Employees]
In_Attendance = Forms![main menu]![employees at work]![In Attendance]
DoCmd.GoToControl "Employees at work"
DoCmd.GoToControl "In Attendance"
DoCmd.GoToRecord , , acFirst
Dim at_work_list As Recordset
Set at_work_list = Forms![main menu]![employees at work].Form.RecordsetClone
at_work_list.MoveFirst
at_work_list.MoveLast
If at_work_list.RecordCount > 0 Then
at_work_list.MoveFirst
For i = 1 To at_work_list.RecordCount
If In_Attendance = Special_Employee Then
DoCmd.GoToControl "special Employees"
Exit Sub
Else
DoCmd.GoToRecord , , acNext
Special_Employee = Forms![main menu]![employees at work]!
[In Attendance]
End If
Next
End If
DoCmd.GoToControl "special Employees"
End Sub