Ah, yes, the code:
Private Sub Form_Current()
'============================================================
' Purpose: Manage the navigation buttons
' Copyright: Larry Daugherty
' Company: Business Process Solutions
' Programmer: Larry Daugherty
' Called From:
' Date: 11/13/02
' Parameters:
' Notes; REmoved all references to cmdNew s the Edit form
doesn't add records
'============================================================
On Error GoTo Form_Current_Err
Dim strErrMsg As String 'For Error Handling
'Dim recClone As Recordset
Dim recclone As DAO.Recordset
Dim intNewRecord As Integer
'Make a clone of the recordset underlying the form so
'we can move around that without affecting the form's
'recordset
Set recclone = Me.RecordsetClone()
'Set recClone = Me.RecordsetClone
'If this is a new record then disable the <Next> and <New>
'buttons and enable the others. Then exit the procedure.
'The next line requires that there be an autonumber field xxnamexxID
intNewRecord = IsNull(Me.TranscriptID)
If intNewRecord Then
cmdFirst.Enabled = True
cmdNext.Enabled = False
cmdPrevious.Enabled = True
cmdLast.Enabled = True
'Exit Sub
GoTo Form_Current_Exit
End If
'If we reach here, we know we are not in a new record
'so we can enable the <New> button
'But we need to check if there are no records. If so,
'we disable all buttons except for the <New> button
If recclone.RecordCount = 0 Then
cmdFirst.Enabled = False
cmdNext.Enabled = False
cmdPrevious.Enabled = False
cmdLast.Enabled = False
Else
'Synchronise the current pointer in the two recordsets
recclone.Bookmark = Me.Bookmark
'If there are records, see if we are on the first record
'If so, we should disable the <First> and <Prev> buttons
recclone.MovePrevious
cmdFirst.Enabled = Not (recclone.BOF)
cmdPrevious.Enabled = Not (recclone.BOF)
recclone.MoveNext
'And then check whether we are on the last record
'If so, we should disable the <Last> and <Next> buttons
recclone.MoveNext
cmdLast.Enabled = Not (recclone.EOF)
cmdNext.Enabled = Not (recclone.EOF)
recclone.MovePrevious
End If
Form_Current_Exit:
'And finally close the cloned recordset
recclone.Close
'And fire the After_Update events of the comboboxes
cboFindPractitioner_AfterUpdate
cboFindTranscriber_AfterUpdate
cboPatient_AfterUpdate
On Error Resume Next
Exit Sub
Form_Current_Err:
Select Case Err
Case Else
strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number)
& vbCrLf
strErrMsg = strErrMsg & "Error Description: " &
Err.Description
MsgBox strErrMsg, vbInformation, "Form_Current"
Resume Form_Current_Exit
End Select
End Sub