Wrong Error message appear, even when everythink works ok

This is the way I did this maybe it will give you some ideas on how to approach your problem: