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.
George_Hepworth
Jan 05, 2024Silver Contributor
In the sub which attempts to open the form, you need to handle the 2501 error when it is returned to that form.