Take that two years to clear up your credit, and that means putting your money towards outstanding credit card bills and loan notes, and other expenses that you have swept under the table and have left you in the mess you are in, then getting a very low limit credit card and responsibly building your credit back up... there is no way to purchase a home or qualify for a mortgage with bad credit. This probably isn't the answer you want to hear, but buying requires cleaning up your credit. However, there is a second option you'd probably like better than this one:
Find a home "for sale by owner" or "for rent", and try to negotiate a rent to own arrangement with them. Rent to own allows you to live in the home of your dreams and pay rent on it, and a portion of that rent goes towards your down payment to purchase the home in the future (So your two year goal might just work for you!) You strike up an agreement with the homeowner that it will take you X amount of time, usually in years, to clean up your credit and purchase the home. This option is actually ideal for people in your situation, take it from someone who has been there.
If you want to be successful with option number two and get into your dream home, you'll probably have a tricky time finding a house for sale that you love where the owners are willing to get into this type of arrangement with you. Usually they need to have a rent to own arrangement already on their mind, and these are sellers who are ready to get the property off of their hands as soon as they can and need instant cash flow, so they're willing to take a chance on a rent to owner.. but it does make them feel better if you've been pre-screened and they know you are going to be a reliable and trustworthy tenant.
There is a way to make the whole rent to own process much easier, faster, and find the right home and right seller without searching for months on end, and that's leaving the dirty work (contracts, negotiating, finding the home and seller) to an experienced home investor or real estate broker. Investors don't charge you for these services because they are making a profit off of the home as a go between, so you don't have to worry about commission fees like you would if you were using a real estate agent. Not to mention, many of them have experience with home appraisal and mortgage arranging and can help you out significantly in these areas, even suggesting how to fix your credit.
I can give you the contact info for the investors I went with when I was looking for my home, they did an amazing job finding me a home and making sure the arrangement was something I could live with to make sure I was able to buy the home and get my credit straight in time. Visit their website and fill out their interested buyers list here: http://www.rent-to-own-homes.biz/rent-to-own-buyers/join-our
Best of luck!