I have a Main Form (Itineraries) which has a Command Button (Command11) . On the main fom I also have a sub form (ItineraryDetai ls). Now for every Itinerary details record there is sub sub form (ItineraryAccom odation) that I want to refer to. Would you be able to help me out I have attached an image of how the form is structured.
Below is the sample code I have tried to create.
Below is the sample code I have tried to create.
Code:
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ItineraryAccomodation"
stLinkCriteria = "Me.ItineraryDetails.Form.[ItineraryDetailID]=" & Itineraries.ItineraryDetails.ItineraryAccomodation.Form.[ItineraryDetailID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command11_Click:
Exit Sub
Err_Command11_Click:
MsgBox Err.Description
Resume Exit_Command11_Click
End Sub
Comment