Share via

error mapping

Anonymous
2019-12-07T09:31:18+00:00

Hi

Is there a friendly way of error mapping

basically if the database runs out of data I get message 2105 cannot go to the specified record

I want to change that just to read something like" No records available"

Is there any free code that can help with this please

thanksyou

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2019-12-08T05:42:39+00:00

    perfect

    thank you so much, great help

    is there also a way I can either remove or rename the box to not show ms access in the title box

    Was this answer helpful?

    0 comments No comments
  2. ScottGem 68,830 Reputation points Volunteer Moderator
    2019-12-07T23:51:53+00:00

    Hi Mark,

    The On Error Goto goes at the top of the sub. The Exit and what follows goes at the bottom. Your code goes in between.

    Was this answer helpful?

    0 comments No comments
  3. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2019-12-07T18:58:28+00:00

    Your code is supposed to go between

    On Error Goto Err_Form

    and

    Exit_Form:

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2019-12-07T14:15:36+00:00

    hi scott

    thanks for your help

    I have a command button,(cmdClick) that simply moves to the next record

    I have tried to put this code in after DoCmd.GoToRecord , , acNext and nothing happened 

    any ideas most appreciated

    Was this answer helpful?

    0 comments No comments
  5. ScottGem 68,830 Reputation points Volunteer Moderator
    2019-12-07T12:38:29+00:00

    Hi Mark, I'm an independent adviser and will try to help.

    Access has error trapping. The error you refer to is a Form error which means it occurs when you try to move from record to record. So, I believe, you would need to put your error trapping code in the Form's On Error event.

    The code would look like this:

    On Error Goto Err_Form

    Exit_Form:

     Exit Sub
    

    Err_Form:

     Select Case Err.Number
    
          Case 2105
    
               MsgBox "No Records Available"
    
          Case Else
    
                MsgBox Err.Number & "-" & Err.Description
    
     End Select
    

    However, if you are using other than the Navigation button to move to another record, you might have to put that code in the method you are using to change records.

    I would do a search on 'MS Access error trapping" to find several articles on how to do error trapping in Access.

    If you need any further clarification on this please feel free to ask.

    Was this answer helpful?

    0 comments No comments