|
6d老师:
我还有一个问题:想在Totaldemand中的demand文本框中输入一个条件:200923 to 200927
怎样编写?
谢谢
yanwei82123300 发表于 2009-4-5 15:10
- Private Sub demand_AfterUpdate()
- Dim strArray() As String
- Dim strTemp As String
- Dim strSQL As String
- Dim Qdf As DAO.QueryDef
- Dim i As Long
- Dim BeginVal As Long, EndVal As Long
- If IsNull(Me.demand) Then Exit Sub
- strArray = Split(Me.demand, "to")
- BeginVal = Val(strArray(0))
- EndVal = Val(strArray(UBound(strArray)))
- For i = BeginVal To EndVal
- strTemp = strTemp & "Nz([" & i & "])+"
- Next
- strTemp = Left(strTemp, Len(strTemp) - 1)
- strSQL = "SELECT Table1.*, " & strTemp & " AS total FROM Table1"
- Set Qdf = CurrentDb.QueryDefs("qryTotaldemand")
- Qdf.SQL = strSQL
- Qdf.Close
- Set Qdf = Nothing
- Me.RecordSource = "qryTotaldemand"
- End Sub
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|