You may also notice common behavior problems in your dog such as jumping up, barking, or even aggression. The best way to correct any misbehavior is to interrupt it. Shift your dog's attention to something positive. Try running through cues that your dog has mastered followed by rewards. Keep your demeanor cool and confident, and be clear about what you mean.
Be persistent! Make sure the puppy doesn't get the opportunity to pee and poop by using a leash indoors or confining him to a crate when you're out. Depending on the puppies age, pop him outside every 20 - 30 minutes, so there's a greater chance of him toileting outside (by accident at first.) In addition, get rid of any scent markers he's left by peeing or pooping indoors, as these will draw him back to the same spot. This means cleaning the area daily, for 2- 3 weeks after he last pooped there to fully get rid of any lingering odor that the dog can detect.
You should always accompany your puppy outside for potty breaks. You’re there not only to ensure that he actually goes, you’re also there to reward your puppy with a treat for going in the proper spot. Wait until your puppy finishes eliminating and immediately give him a tasty reward for a job well done. If you wait until you get back in the house, your puppy won’t make the connection between his elimination and the reward.
The process is the exactly same for older dogs as it is for puppies; prevent accidents from happening by using baby gates and a crate if possible, create a predictable schedule, learn to recognize your dog’s potty signals, accompany your dog outside and immediately reward for all outdoor elimination, properly clean any accidents and supervise your dog until you’re sure that he understands the rules.