Access: Research Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

DoCmd Open and Link Form

In the middle are the dimensions and the command. The name of the form (stDocName) and how they are linked (stLinkCriteria) are defined as a String. The DoCmd opens the form and identifies the link. The entire routine looks like this:

 

            Private Sub Movie_DblClick(Cancel As Integer)

            On Error GoTo Err_Movie_DblClick

 

                        Dim stDocName As String

                        Dim stLinkCriteria As String

 

            stDocName = "MovieTitles"    

            stLinkCriteria = "[ID]=" & Me![ID]

 

            DoCmd.OpenForm stDocName, , , stLinkCriteria

 

            Exit_Movie_DblClick:

                        Exit Sub

 

            Err_Movie_DblClick:

                        MsgBox Err.Description

                        Resume Exit_Movie_DblClick

            End Sub