First Record

24sharon

Registered User.
Local time
Today, 13:33
Joined
Oct 5, 2004
Messages
147
HELLO,

How am I know if I in the first record?

I have a form with subform
I change the navigation Buttons to>>> no and I built 2 buttonse NEXT and BACK.

But when I am in the first record and click back I got an ERROR
“You can’t go to the specified record.”

I want to check if I in the first record, I’ll locked the back’s button .


GOOD DAY!
Sharon
 

Attachments

  • untitled.JPG
    untitled.JPG
    78.9 KB · Views: 123
If the form's recordset is available, it's .BOF property is TRUE if you are at the beginning of the recordset.
 
the Mdb man

THANKS,

but how can I check it with code? [in the form current]
 
OK I got it

HERE:
Code:
Private Sub Command25_Click()
    
Dim gmsgText As String

On Error GoTo ReportError

  DoCmd.GoToRecord , , acPrevious

ExitProcedure:
  On Error Resume Next
  DoCmd.Hourglass False
  DoCmd.SetWarnings True
  Exit Sub

ReportError:
  
  Select Case Err.Number
    Case Is = 2105
      ' You can't go to the specified record.
      ' Do nothing
    Case Else
      gmsgText = "Error in " & Me.Name & ".btnPrevious_Click()" _
        & vbCr & "Error number " & CStr(Err.Number) _
        & " was generated by " & Err.Source _
        & vbCr & Err.Description
      MsgBox gmsgText, vbExclamation + vbMsgBoxHelpButton, "Error", Err.HelpFile, Err.HelpContext
  End Select
  Resume ExitProcedure

End Sub
 

Users who are viewing this thread

Back
Top Bottom