First off, let's make sure to keep our dogs' potty area clean. Picking up your dogs' stools can help you asses their overall health and check for worms or upset stomach.
If you catch your puppy in the ACT of having an accident; say NO and scoop the puppy up, quickly carrying them outside to finish with praise.
NEVER rub a dogs nose in an accident! They will not associate your anger with the mess. Yes they will look sad, but only because you are yelling at them, and they don't know why.
If you come across an accident, stay calm.