Office中国论坛/Access中国论坛
标题:
紧急求助,排序问题
[打印本页]
作者:
iron
时间:
2004-7-27 23:03
标题:
紧急求助,排序问题
下面是一段计算余额的代码,我希望按Index, 会计期间, 总帐日期, 凭证编号, ID 排序,
不知道怎么写代码,下面红字代码处老是提示无效,请大侠们指点。
Public Sub YUER()
Dim Db As ADODB.Connection, varBalance As Double, IND As String
Dim Rs As Recordset
Set Db = New ADODB.Connection
Set Rs = New ADODB.Recordset
Rs.ActiveConnection = CurrentProject.Connection
Rs.Open "帐簿临时表", , adOpenDynamic, adLockOptimistic
varBalance1 = 0
varBalance2 = 0
IND = Rs!Index
Rs.Index Rs![Index], Rs![会计期间], Rs![总帐日期], Rs![凭证编号], Rs![ID]
Do Until Rs.EOF
If Rs!Index <> IND Then
varBalance1 = 0
varBalance2 = 0
IND = Rs!Index
End If
Rs.CancelUpdate
Rs("转换余额") = Round(Nz(Rs!转换借项, 0) - Nz(Rs!转换贷项, 0) + varBalance1, 2)
Rs("输入余额") = Round(Nz(Rs!输入借项, 0) - Nz(Rs!输入贷项, 0) + varBalance2, 2)
Rs.Update
varBalance1 = Rs!转换余额
varBalance2 = Rs!输入余额
Rs.MoveNext
Loop
Rs.Close
End Sub
作者:
iron
时间:
2004-7-28 16:23
谢谢
tmtony
,解决了。
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3