|
4#
楼主 |
发表于 2021-9-4 23:03:04
|
只看该作者
唉!无助了几天,琢磨几天,终于解决,附上供需者参考
Dim rs3 As New ADODB.Recordset
Dim ssql3 As String
Dim jj, hh, kk, pp, nn As Integer
ssql3 = "select 世代,原页,印页 from 表 ORDER BY 世代,原页 "
rs3.Open ssql3, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs3.MoveFirst
pp = 0
For I = 1 To CLng(rs3.RecordCount)
jj = rs3!世代
hh = rs3!原页
kk = jj + Int((rs3!原页 - 1) / 5) '原页5页变一页
If hh <= 5 Then
rs3!印页 = kk + nn
Else
nn = DLookup("印页-世代", "表", "世代=" & jj)
End If
rs3!印页 = kk + nn
nn = nn + kk - jj
rs3.Update
'' jj = rs3!世代 + 1
rs3.MoveNext
Next I
rs3.Close
Set rs3 = Nothing
|
|