|
本帖最后由 Henry D. Sy 于 2012-9-21 13:42 编辑
- Public Function gValue(strWeek As String) As Double
- Dim rs As New ADODB.Recordset
- Dim strSQL As String
- Dim tempVa As Double, tempVb As Double
- strSQL = "select top 2 实际价值 from sheet1 where 周期<='" & strWeek & "' order by 周期 desc"
- rs.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
- tempVa = rs(0)
- If rs.RecordCount <= 1 Then
- tempVb = 0
- Else
- rs.MoveNext
- tempVb = rs(0)
- End If
- gValue = tempVa - tempVb
- rs.Close
- Set rs = Nothing
- End Function
复制代码- SELECT Sheet1.周期, Sheet1.设计价值, Sheet1.实际价值, gValue([周期]) AS 每周价值
- FROM Sheet1;
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|