|
NO. 1: =RecordNumber("第",me)'me指当前窗体
Function RecordNumber(pstrPreFix As String, pfrm As Form) As String On Error GoTo RecordNumber_Err Dim rst Dim lngNumRecords As Long Dim lngCurrentRecord As Long Dim strTmp As String
Set rst = pfrm.RecordsetClone rst.MoveLast rst.Bookmark = pfrm.Bookmark lngNumRecords = rst.RecordCount lngCurrentRecord = rst.AbsolutePosition + 1 strTmp = pstrPreFix & " " & lngCurrentRecord & " 页," & " 共 " & lngNumRecords & " " & "页" RecordNumber_Exit: On Error Resume Next RecordNumber = strTmp rst.Close Set rst = Nothing Exit Function RecordNumber_Err: Select Case Err Case 3021 strTmp = "New Record" Resume RecordNumber_Exit Case Else strTmp = "#" & Error Resume RecordNumber_Exit End Select End Function
NO. 2 Function RecordNum(frmData As Form) As String On Error Resume Next frmData.RecordsetClone.MoveLast DoEvents If frmData.NewRecord = True Then RecordNum = "新记录" & "/共" & frmData.RecordsetClone.RecordCount & "条" Else RecordNum = "记录" & frmData.CurrentRecord & "/共" & frmData.RecordsetClone.RecordCount & "条" End If End Function
|
|