As long as your dog is healthy there are a number of options, depending on your dog.
Which type of "messing" are you referring to? And what size/breed is your dog?
All these will determine your next step. For instance if you haven't tried crate training him yet, it is your best first option. See my hub on house-breaking for a detailed explanation of crate training.
If he is urinating inside, this is most likely because the scent is already there, and you will have to thoroughly clean your floors, carpets, etc., where he's urinated.
I've found gallons of "Nature's Miracle" is truly miraculous for cleaning urine scent. Expensive, but worth it. You would follow the indoor cleaning with a spray to use outside which will prompt him, through its scent, to "let down" his urine. Dogs cannot help but pee when they smell pee, it is a physical reaction.
If you have a small dog, there are indoor pee pads of all designs from grass-like to mats, which once you spray with the urine scent, work well. Then you can gradually move the pee pad outside. They are easy to clean off with a garden hose.
No matter what, if you want a predictably house-trained dog, you have to be committed and vigilant until the job is done. You simple can't slack on it, at all. It's a big job, and can take several months especially with an older dog, but worth once it's done. You have to watch your dog constantly. That's why the crate training is so great! In a properly-sized crate, your dog will not soil it and you can dash him out when you let him out. If your dog is large, outdoor kenneling is helpful in decent climates if you work all day and he is home alone.
That said, you have to limit the length of time he's in the crate, because eventually he won't be able to hold it and then once he soils the crate, crate training is out the window too.
Try these, let me know how it goes and as always, Good Luck and Good Dog!