I have a datagrid/list box that populates a few row/columns, one of which is a primary key “FacilityID”. When double clicking the a specific row a new form will open with that FacilityID assigned to it. This worked fine until I put a tab control on realizing I needed more. How do you reference and tab control on the new form with the FacilityID from the datagrid?
This doesn't work:
This doesn't work:
stDocName = "Check_List!TabCtl25"
Dim rs As DAO.Recordset
Dim strsql As String
Dim strFacilityID As String
strFacilityID = Me.lst_CheckListView.Column(0)
strsql = "SELECT FacilityID FROM CheckList WHERE FacilityID = " & strFacilityID
Set rs = CurrentDb.OpenRecordset(strsql)
'Check to see if the recordset actually contains rows
If Not (rs.EOF And rs.BOF) Then
stDocName = "Check_List!TabCtl25"
stLinkCriteria = "[FacilityID]=" & strFacilityID
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox "No Match"
Call ChecklistEnter
End If
rs.Close 'Close the recordset
Set rs = Nothing 'Clean up