|
请教:下面代码“合同签订日期”字段是日期--2016/7/23--,而要查询的是“年度”,想用--aa--取前4位转换成“年度”,不知如何写代码?
请大师指教。谢谢!
Private Sub TreeView3_NodeClick(ByVal Node As MSComctlLib.Node)
Dim treeFlag As String
treeFlag = Left(Node.Key, 1)
Dim aa
aa = Left(rs3.Fields("合同签订日期"), 4) & "年度"
Select Case treeFlag
Case Is = "d" '点击总节点时
SQL = "select * from 基础档案表 ORDER BY 项目编号 ASC"
Call addLIST
Case Is = "F" '点子节点时
SQL = "select * from 基础档案表"
SQL = SQL & " where 合同签订日期 ='" & Node.Text & "' ORDER BY 项目编号 ASC"
SQL = SQL & " where " & aa & " ='" & Node.Text & "' ORDER BY 项目编号 ASC"
Call addLIST '调用填充数据程序
End Select
End Sub
|
|