请帮忙修改一下,谢谢!作者: miaowenxin 时间: 2007-10-27 21:04
我是个菜鸟请大家帮帮我把!作者: 张杨 时间: 2010-3-16 16:31
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