My first time to this group so please be kind.
Anyway I have this questionnaire that has two parts (2 tables). I
created a form for each of the tables and I am trying to make it so
that when I go to the other form I would go directly to the
corresponding record from the first form. And if it doesn't find a
corresponding record, it just opens a new record for data entry.
I have this piece of code from many months ago (from a yahoo group)
and it works great if I only have one record per patient person but now
my database has multiple records per patient and I haven't been able to
modify this code to search on two keys (say clinid and visit) instead
of just one (clinid).
Thanks,
Ryan
Private Sub Form_Load()
Dim rs As Object
If IsNull(clinid) = False Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[clinid]= '" & OpenArgs & "'"
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
DoCmd.GoToRecord , , acNewRec
Forms!md12_part2_form!clinid.SetFocus
End If
Set rs = Nothing
Else
Forms!md12_part2_form!clinid.SetFocus
End If
End Sub