I'm not a fan of deleting information. What about making a "status" field that could hold say active or inactive. Then your Delete script could change the flag rather than delete records.
The Structure of the If steps seem strange.
As posted, the script will permit deleting all records in the found set If a matching password is entered correctly, but not if the password is all caps and the caps lock is depressed (The upper function does not effect results here since the test is true only if caps lock is down). Then, at the end, a custom dialog tells the user that the password was incorrect even if, in fact, it was entered correctly.
I suggest simplifying the system by using accounts and privileges to control which user is able to delete records. Then, rewrite your script to be:
If [ get (privilegesetname) = "[Full access]" ]
Show custom dialog ["Do you want to delete all records in the found set?"]
IF [ get ( lastmessagechoice ) = 1 /* User clicked first button, labeled "Yes" */]
Delete All Records [No Dialog]
Show Custom Dialog ["Your password does not permit you to delete all records in the found set"]