I just got my yorkie on Sunday. He has been good, but he is haveing accidents

He has been good about peeing, but pooping...thats another story. He has just peed on the carpet, even though I took him out 5 minutes earlier. He has been out multiple times today.... :/
Any advice?