|
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
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函数未定义,请高手们帮帮忙。?谢!红色为电脑提示部分。 |
|