none
VBScript that traps error "Access Denied" RRS feed

  • Question

  • I am newbie in VBScript. I have been trying a script where my requirement is, if the "ACCESS DENIED" error is coming, I need a prompt "Do you still want to continue?".

    My question is how can we trap the "ACCESS DENIED" error and as user ""Do you still want to continue?"

    Kindly, push me in right direction. Thanks in advance.

    Wednesday, January 7, 2015 11:56 AM

Answers

All replies

  • Yes just use normal VBScript error methods.  Check for the error and ask the question then take required action.

    There is no specifc one lineof code to do this.  You will have to write it.

    See this for examples: http://technet.microsoft.com/library/ee176982.aspx


    ¯\_(ツ)_/¯

    Wednesday, January 7, 2015 12:45 PM
  • Can't I just check if

    Err.Source = "Access Denied"
    ?

    Wednesday, January 7, 2015 2:01 PM
  • Read the information in the link I posted.  It will exaplin it with examples.


    ¯\_(ツ)_/¯

    Wednesday, January 7, 2015 2:04 PM
  • I read it and its going over my head. I think I need to read it thoroughly. But as quick solution, as its urgent, can you please tell me if the below command will work or not? I am sorry for the trouble.

    Err.Source = "Access Denied"

    As, when I simply print Err.Source, it returns "Access Denied". So I guess I can compare it with the string like above, right?
    Wednesday, January 7, 2015 2:12 PM
  • The quick answer is no.

    Err.Number <> 0

    or

    Err.Number = 5 ' or whatever error number you want to use.


    ¯\_(ツ)_/¯

    Wednesday, January 7, 2015 2:18 PM
  • The quick answer is no.

    Err.Number <> 0

    or

    Err.Number = 5 ' or whatever error number you want to use.


    ¯\_(ツ)_/¯

    Thank you very much. This is the answer I was looking for.
    Thursday, January 15, 2015 9:13 AM