
Find Record in another open form and Close Form with call
Quote:
> I have 2 forms ( Among many others that are not relevant)
> (1) Form [Person Main] and (2)Form [Add/Edit Person]
> A/E Person can be opened from Person Main as well as from other
> places.
> I would like to Find the Record that I just entered in Add/Edit Person
> on Person Main and then Close Add/Edit Person. (prefferably run this
> all from 1 button or macro)
> Any Help is appreciated.
If you can code....
Assumes there is a field PersonID and it is type numeric/long
Add a statement at the declaration part of the form's module
Dim lngID As Long
In the forms AfterUpdate event enter
lngID = Me.PersonID
In the forms OnClose event enter
If lngID <> 0 Then
Dim rst As Recordset
Set rst = Forms!PersonMain.Recordsetclone
rst.FindFirst "[PersonID] = " & lngID
If not rst.nomatch then
Forms!PersonMain.bookmark = rst.bookmark
endif
set rst = Nothing
endif
Code like the above should provide a starting point. If you don't know
what some of those things mean...recordsetclone, recordset, findfirst,
nomatch then check on-line help.