vsprint打印实例(2) rst.CursorType = adOpenKeyset rst.LockType = adLockOptimistic rst.Open strSql, con, , , adCmdText cols = 13 If Not rst.BOF And Not rst.EOF Then '获得总的记录数rows rst.MoveFirst Do While Not rst.EOF Rows = Rows + 1 rst.MoveNext Loop '重新设置行的位置为第一条记录 rst.MoveFirst '设置总的页面数 If Rows <= 18 Then '总行数小于等于页面显示的总行数 pages = 1 iCurrenrows = Rows iLastrows = 0 Else '总行数大于页面显示的总行数 If Rows Mod 18 = 0 Then '总行数等于页面显示的总行数倍数 pages = Int(Rows / 18) iLastrows = 0 Else '总行数不等于页面显示的总行数倍数 pages = Int(Rows / 18) + 1 iLastrows = Rows Mod 18 End If iCurrenrows = 18