DAO实现的子窗体记录分页显示
时间:2009-12-15 08:35 来源:网络 作者:t小雨 阅读:次
|
关键代码:
Private Function ChangeRstPage(frm As Form, rst As DAO.Recordset, sFldID As String, iPageRecCount As Integer, iCurrentPage As Integer)
' 将按页码筛选后的记录集作为窗体记录集
Dim iStartNumber As Integer
Dim lngStartID As Long
Dim lngLastID As Long
iStartNumber = (iCurrentPage - 1) * iPageRecCount
With rst
If .RecordCount > 0 Then
.MoveFirst
.Move iStartNumber
If .EOF Then Exit Function
lngStartID = .Fields(sFldID)
.Move iPageRecCount - 1
If .EOF Then .MoveLast
lngLastID = .Fields(sFldID)
.Filter = sFldID & " Between " & lngStartID & " And " & lngLastID
End If
Set frm.Recordset = .OpenRecordset
End With
End Function
附件:
点击下载此附件
|
|
(责任编辑:admin)