This example assumes:
- the other form is named "frmEmployee", as is open;
- the popup form has a text box named "EmployeeID", which matches the
EmployeeID autonumber field on frmEmployee.
The code sames the record in the employee form if necessary, then tries to
find the matching record in the form's RecordsetClone, and if found moves
the form to that employee.
Dim frm As Form
If Not IsNull(Me.[EmployeeID]) Then
Set frm = Forms("frmEmployee")
If frm.Dirty Then 'Save any edits
frm.Dirty = False
End If
With frm.RecordsetClone
.FindFirst "[EmployeeID] = " & Me.[EmployeeID]
If Not .NoMatch Then
frm.Bookmark = .Bookmark
End If
End With
End If
Set frm = Nothing
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Kenny said:
I have a main form that displays a bunch of employee information that
comes from various tables. I also have a pop up form that allows me to edit
employee demographics or add an employee. I'd like to set up the forms such
that if I'm working on a particular employee on the pop up, that when I exit
that pop up, the main form is now displaying that same employee (regardless
of which employee was selected before going to the pop up).