Are you looking for fix the MS Access Run-time error 2501? In this post I’ll show you how to fix the problem and handle this error. Basically this error shows when you apply a button for open a form or report by VBA or Micros. Most of new Ms Access developer confused when they can’t fix the error. Don’t worry I’ll give you the 100% solution to fix this error. Let’s see the process.
Private Sub Command1_Click() On Error GoTo Err_Command1_Click DoCmd.OpenForm "myForm" Exit_Command1_Click: Exit Sub Err_Command1_Click: MsgBox Err.Description Resume Exit_Command1_Click End Sub
Finished! Now save your code and try it. I think your problem has solved successfully.