Consulting

Results 1 to 2 of 2

Thread: Run Time Error 2105

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Run Time Error 2105

    Hi All,

    I've made a bare basic Access db. I have also added some records navigation buttons for it. The thing is, when if I am on the very first record or the last record, and I press previous or next buttons, I get the Run Time Error 2105.

    c002.JPG

    Is there a code that I could use so that when I press next or previous on the last and first entries that Access would show no further records exists.

    --- or ---

    Is there an IF or other code that when that I press the next button on the last record, it loops back to the first record and vice versa.

    Here's my next and previous button codes.

    Private Sub cmdNewRecord_Click()
    DoCmd.GoToRecord , , acNewRec
    End Sub
    
    Private Sub cmdNextRecord_Click()
    DoCmd.GoToRecord , , acNext
    End Sub
    
    Private Sub cmdPreviousRecord_Click()
    DoCmd.GoToRecord , , acPrevious
    End Sub

    P.S. I'm really rusty with vba, basic codes would be of big help.
    Last edited by Aussiebear; 04-08-2023 at 03:49 PM. Reason: Adjusted the code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •