Results 1 to 6 of 6
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658

    Proactive 2105 error for bof/eof?


    I've got buttons on a form for previous and next record.
    It gets the expected 2105 error at when going beyond the first or last records as expected.
    At the moment I have it trapped in error handling.
    I would like to be proactive. (the reason is I often turn off error handling for debugging code, and this error then gets in the way)
    I've tried me.recordset.bof & .eof but they always come back false just before the DoCmd.GoToRecord Record:=acPrevious is executed.
    Is there a better/correct way to test?
    Thanks

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    use .absoluteposition

    here's a custom class for navbars. See the test for .AbsolutePosition in the class module.
    The 2nd to last argument -Optional CycleRecs As Boolean = True - determines whether the records cycle either to the first or last records at the end, or if a message box is fired.
    Attached Files Attached Files
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    Quote Originally Posted by moke123 View Post
    use .absoluteposition

    here's a custom class for navbars....
    Thanks, that tip did the trick. And, you'll keep me busy analyzing how you managed to turn my ten lines of code into 150 or so!

  4. #4
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Quote Originally Posted by twgonder View Post
    Thanks, that tip did the trick. And, you'll keep me busy analyzing how you managed to turn my ten lines of code into 150 or so!
    write it once and I never need to write it again. Just drop it in an app and 3 lines of code and it works. No need to code any of the command buttons.
    Code:
    Dim clsNB As clsNavBar
    
    
    Private Sub Form_Load()
    Set clsNB = New clsNavBar
    clsNB.InitCls Me, Me.btonext, Me.btoprev, Me.btoFirst, Me.btoLast, Me.btoNew, True
    End Sub
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  5. #5
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    Quote Originally Posted by moke123 View Post
    write it once and I never need to write it again. Just drop it in an app and 3 lines of code and it works. No need to code any of the command buttons.
    ...
    [/CODE]
    Yep, I do the same with a form template. All my ten lines are in one module. It's just not a class module:
    https://www.accessforums.net/showthr...304#post502304

    However, I will want to examine all the other tricks you did in yours. Good job.

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    However, I will want to examine all the other tricks you did in yours. Good job.
    Given some of your non-traditional methods I'm surprised you don't use any custom classes.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 08-26-2021, 05:06 PM
  2. Run-time error 2105
    By flantrains in forum Programming
    Replies: 3
    Last Post: 12-09-2019, 12:53 AM
  3. Error 2105 all of a sudden
    By TaliaKlein in forum Forms
    Replies: 7
    Last Post: 11-09-2015, 10:47 AM
  4. Replies: 5
    Last Post: 08-22-2012, 04:27 AM
  5. Replies: 1
    Last Post: 06-04-2012, 03:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums