|
Private Sub TreeView0_NodeClick(ByVal Node As Object)
Dim strCARGOTYPE_NO As String
Dim strSQL As String
Dim i As Integer
Dim n As Integer
Dim strTip As String
Dim a As String
Dim left As String
strCARGOTYPE_NO = Right(Node.Key, Len(Node.Key) - 3)
'判断是否是顶层
If strCARGOTYPE_NO = "1" Then '预先定义好的:NO.1,第3位向后的字符,所以是1
strSQL = "SELECT * FROM ck_库存查询;"
Me.lblTip.Caption = "库存"
Else
i = Len(strCARGOTYPE_NO)
strSQL = "SELECT * FROM ck_库存查询 WHERE left([分类编号]," & i & ")='" & strCARGOTYPE_NO & "';"
'Debug.Print I
For n = 1 To i / perSectionLong
strTip = strTip & Trim(CurrentDb.OpenRecordset("SELECT CARGOTYPE_NAME FROM 产品分类 where left([CARGOTYPE_NO]," _
& (n * perSectionLong) & ")='" & left(strCARGOTYPE_NO, (n * perSectionLong)) & "' and CARGOTYPE_LEVEL=" & n & ";")(0).Value) & ">>"
Next
strTip = "库存" & ">>" & left(strTip, Len(strTip) - 2)
Me.lblTip.Caption = strTip
End If
'Debug.Print strSQL
Me.subMX_CARGO.Form.RecordSource = strSQL
End Sub
我这个也是按例子编写的总提示函数未定义是left函数,你要知道了请帮我解答一下。谢! |
|