代码如下: 'update the tmpALRpt3_AftUpdData special field.
Sub frmAftUpdDatSpeFldVal(ByVal intTotAL As Integer, ByVal intNewAL As Integer)
Dim dbsDB As Database, rsAftUpdRecord As Recordset
Dim strNetCapAmt, strRevUnAmo, strCatUpAmt, strSql As String
Dim intMob, intRows, intTotRow As Integer
Set dbsDB = CurrentDb
1) Set rsAftUpdRecord = dbsDB.OpenRecordset("tmpALRpt3_AftUpdData", 1)
‘这时RecordCount的结果时正确的’
2):Set rsAftUpdRecord = dbsDB.OpenRecordset("select * from tmpALRpt3_AftUpdData")
'当时这种情况时,得到的RecordCount 结果变成1了,是错误的。
For intRows = 1 To rsAftUpdRecord.RecordCount
'begin to update the specail field
intMob = intRows
If intMob <= intNewAL Then
strNetCapAmt = rsAftUpdRecord.Fields("NetCapAmt")
strNetCapAmt = forSepFldVal(CDbl(strNetCapAmt), 2, "Normal")
'field2
strRevUnAmo = rsAftUpdRecord.Fields("RevUnAmoAmt")
strRevUnAmo = forSepFldVal(CDbl(strRevUnAmo), 2, "Normal")