On twine you should be able to use a variable to store what codes are entered and check if the new one is not in the list before validating it (you might need to code some javascript for that tho)
The version I am playing in the browser right now recognizes correct access codes, identifies duplicate entries and denies access, and rejects invalid codes and denies access... I can't reproduce your error, what version are you playing? (They have date codes)
For every entered code, the system checks to see if the source list contains the code, then it checks the list of already validated codes. If the code is both valid and not contained in the validated code array, it's added to the validated code array, and the count of valid codes is incremented. If a code is valid and duplicate, the count is reset to 0, which denies the user access. I did it this way so that users can see which codes are invalid, because I thought some people might make spelling mistakes.
-Jess