Private Sub OpenDetail()
Dim checkedNodes As Collection
Dim strSql As String
Dim I As Integer
Dim nd As Node
Dim PK As Long
Set checkedNodes = TVW.GetCheckedNodes
strSql = "Update tblLocations set Selected = false"
CurrentDb.Execute strSql
strSql = "Update tblItems set Selected = False"
CurrentDb.Execute strSql
If checkedNodes.Count > 1 Then
For I = 1 To checkedNodes.Count
Debug.Print checkedNodes(I).Key
Set nd = checkedNodes(I)
If nd.Tag = "LO" Then
PK = CLng(Replace(nd.Key, "LO", ""))
strSql = "Update tblLocations set Selected = True where LocID = " & PK
Debug.Print strSql
CurrentDb.Execute strSql, dbFailOnError
ElseIf nd.Tag = "IT" Then
PK = CLng(Replace(nd.Key, "IT", ""))
strSql = "Update tblItems set Selected = True where ItemID = " & PK
CurrentDb.Execute strSql, dbFailOnError
End If
Next I
DoCmd.OpenForm "frmDetail"
Else
DoCmd.OpenForm "frmDetail"
End If
End Sub