Runtime Error 2501 --- Why?

  • Thread starter Thread starter TC
  • Start date Start date
T

TC

I assume that the form *is deleted* even when the password is set?

(If the form was *not* deleted when the password was set, the error would of
course make sense.)

TC
 
Hello all:
I get a run-time error 2501 (Action Canceled
error) while deleting a form using DoCmd.DeleteObject from
within VBA code. I get this error only if the VBA code is
password-protected! In other words, if I remove the
password protection on viewing VBA code, then this error
does NOT occur. I don't get the correlation at all.
Besides, I don't know why this error occurs in the first
place. I am not canceling the DeleteObject action at all.
Any thoughts?

Thanks in advance,
VJ
 
Yes, the form was not deleted. But, why should a password
on VBA code interfere with the running of the VBA code? I
need the password-protection! So, I am looking for work-
arounds...


Thanks,
VJ
 
I assume that the purpose of the password is to ensure that no-one can
change the VBA code without the password?

Say that a user has permissions to *run* VBA code, but not to change it (ie.
he does not know the password).

If Access let that user run some VBA to delete a form (& the associated form
code module) , then, he has effectively bypassed the password!

Perhaps that is the reasoning behind it.

HTH,
TC
 
Back
Top