[求助]access中取值
我想通过treeview上的值找到在数据库中对应的字段Dbd的值,请问该如何写,下面这段程序运行总死机,请高手解决小弟菜鸟,大家别笑我哦~~~
Private Sub TreeView1_DblClick()
Dim str1 As String
Dim msc As ADODB.Recordset
str1 = "select distinct Name,Dbd from Pathdbd order by Name,Dbd"
Set msc = ExecuteSQL(str1)
a = TreeView1.Nodes.Item(TreeView1.selectedItem.Index)
msc.MoveFirst
Do Until msc.EOF
If msc.Fields(1) = a Then
Print msc.Fields(2)
End If
Loop
Print a
Set msc = Nothing
End Sub