Your locate statements are kind of all over the place. If you could comment them out or replace them with PRINT : PRINT like in my last screenshot that would help debugging. My guess however is you aren't checking for A or B right and it is running both. Can you post your code again so I can check?