求助:为什么总是提示"无效的关键字"
求助各位请帮我看看,为什么总是到"Set nod = Tree.Nodes.Add(, , Rs(0), Rs(2), Nz(Trim(Rs(3)), "folder"))"这一句提示"无效的关键字"
在此先谢谢各位了!
Public Sub Connection_String()
ConnectionString = "Provider=sqloledb;Data Source=ZHANGHA;Initial Catalog=mrpdata;User Id=sa;Password=;"
End Sub
Private Sub Form_Load()
Dim Tree As TreeView '树对象
Dim nod As Node '树节对象
Dim Rs As New ADODB.Recordset 'ADODB记录集对象
Dim Conn As New ADODB.Connection
Dim SQL As String
DoCmd.RunCommand acCmdAppMaximize
SQL = "SELECT TreeID, ParentID, TreeCaption, TreeImage, OnAction FROM Tree ORDER BY TreeID;"
Call Connection_String
Conn.Open ConnectionString
Rs.CursorLocation = adUseClient
Rs.Open SQL, Conn, adOpenDynamic, adLockOptimistic
Set Tree = Me.TreeView9.Object
Me.TreeView9.ImageList = Me.ImageList4Tree.Object
Tree.Nodes.Clear
Tree.Indentation = 0
Set Me.List83.Recordset = Rs
Rs.MoveFirst
Do Until Rs.EOF
If UCase(Rs(1)) = "X" Then
Set nod = Tree.Nodes.Add(, , Rs(0), Rs(2), Nz(Trim(Rs(3)), "folder"))
End If
Rs.MoveNext
Loop
Rs.Close
End Sub
[最优解释]
key不能是纯数字串,你的Rs(0)是纯数字的吧?改为:
Set nod = Tree.Nodes.Add(, , "a" & Rs(0)...
试试
[其他解释]
求助各位,帮帮我啊,
[其他解释]
谢谢上楼的,解决了