Open form linked to one of its subform fields

N

Nick Mirro

Need a little coding assistance. I have 2 forms that now subforms to
display visits. The primary forms contain a patient list based on PatientID

The subforms both manage visits and are based on VisitID. Prior, all
patients and all visits were scrolled in forms without subforms.

How can I jump to another form and have it open to the same patient on the
main form, and the same subform Visit record?

Nick


(Here is the code used to jump forms when all patients and all visits were
in both form's recordsets)

Private Sub CommLog_Click()
On Error GoTo Err_CommLog_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCollections"

DoCmd.RunCommand acCmdSaveRecord
stLinkCriteria = "[VisitID]=" & Me![VisitID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_CommLog_Click:
Exit Sub

Err_CommLog_Click:
MsgBox Err.Description
Resume Exit_CommLog_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top