What you need to do is

For each id check each character and if one does not match jump out. If all match unlock door.

FOR idx = 0 TO 9 ' scan bytes in tag
READ (((tagNum-1) * 10) + idx), char ' get tag data from table
IF (char != buf(idx)) THEN goto nextTag
Next

high PortB.4
PAUSE 1000
LOW PortB.4
PAUSE 1000
GOTO Main

nextTag:

I think!