I have a search form that displays a bunch of sales records in a subform based on sql. I also have a more button that will take you to the data entry form based on the id # in the search subform and the ID # in the data entry form. The data entry form also has a subform that displays the sales details. There can be more than one sales record for a particular building. The problem I have is there a way to not only open the data entry form to the specific building record but also have the subform display the correct sale. Currently the subform shows the first sale in the list. The code for the more button is as follows:
Code:
Private Sub cmdMore_Click()
On Error GoTo Err_cmdMore_Click
Dim stDocName As String
Dim stLinkCriteria, stLinkCriteria2 As String
stDocName = "frmData_Entry"
stLinkCriteria = "tblCom_Buildings.[Building_ID]=" & Me![txtID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdMore_Click:
Exit Sub
Err_cmdMore_Click:
MsgBox Err.Description
Resume Exit_cmdMore_Click
End Sub
Comment