open form at key value but not filtered

  • Thread starter Thread starter mcnewsxp
  • Start date Start date
M

mcnewsxp

i'd like to toggle between two forms and keep them in sync via a shared key
field.
both use the same table.
using link criteria applies a filter that i don't need.
tia,
mcnewsxp
 
You can open the secondary form without filtering, and then FindFirst on the
RecordsetClone of the form to locate the same record, using the value of the
primary key field.

Example:
Dim frm As Form
DoCmd.OpenForm "Form2"
Set frm = Forms("Form2")
With frm.RecordsetClone
.FindFirst "[OrderID] = " & Nz(Me.OrderID,0)
If .NoMatch Then
Beep
Else
frm.Bookmark = .Bookmark
End If
End With
Set frm = Nothing

Then to keep them in sync, use the Current event of one form to FindFirst
the same record in the other form.

Note that this could cause you grief if you are editing in both forms at
once. You are likely to get concurrenty errors ("Another user/process
altered the data" type messages), problems where the sync cannot happen
because the record being edited cannot be saveed (e.g. Required field
missing), and so on.
 
Back
Top