Forum Discussion
ChrisAKFS
Jan 05, 2024Copper Contributor
Run-time Error 2501
Hi I have successfully been able to create the necessary VBA code to restrict access to one particular form. This works by having a table of authorised windows usernames and then the code for th...
- Jan 06, 2024I would like to point you to the Northwind 2 Developer Edition template (File > New). It implements a centralized error handler.
It is documented here: https://support.microsoft.com/en-us/office/northwind-2-0-things-you-should-know-3193ff60-a47e-4549-8fdb-8fe900b8360c
A video of Kim and myself discussing error handling in NW2 is here: https://www.youtube.com/watch?v=JXKa-bkuRfk
Specifically, you will find in the main error handling procedure:
140 If lngError = 2501 Then Exit Sub '2501 = The OpenForm action was canceled. Not really an error.
Tom_van_Stiphout
Jan 06, 2024Steel Contributor
I would like to point you to the Northwind 2 Developer Edition template (File > New). It implements a centralized error handler.
It is documented here: https://support.microsoft.com/en-us/office/northwind-2-0-things-you-should-know-3193ff60-a47e-4549-8fdb-8fe900b8360c
A video of Kim and myself discussing error handling in NW2 is here: https://www.youtube.com/watch?v=JXKa-bkuRfk
Specifically, you will find in the main error handling procedure:
140 If lngError = 2501 Then Exit Sub '2501 = The OpenForm action was canceled. Not really an error.
It is documented here: https://support.microsoft.com/en-us/office/northwind-2-0-things-you-should-know-3193ff60-a47e-4549-8fdb-8fe900b8360c
A video of Kim and myself discussing error handling in NW2 is here: https://www.youtube.com/watch?v=JXKa-bkuRfk
Specifically, you will find in the main error handling procedure:
140 If lngError = 2501 Then Exit Sub '2501 = The OpenForm action was canceled. Not really an error.
ChrisAKFS
Jan 09, 2024Copper Contributor
Many thanks for the responses. I hadn't considered using a class module for error handing before, whilst in hindsight it makes perfect sense. On this occasion I chose to handle the error on the DoCmd.OpenForm action rather than the class module. Now you have highlighted this to me I will certainly be looking at this in the future so thanks for that.