|
- Private Sub demand_AfterUpdate()
- 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
- BeginVal = Val(Left(Me.demand, 6))
- EndVal = Val(Right(Me.demand, 6))
- 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
|