Bankruptcy filings typically stay on your credit report for a period of ten (10) years. Just because bankruptcy is on your credit report that doesn't meant that you won't be given credit though. Think of a credit report as a financial diary, that tells creditors who are thinking of lending you money what you have done over the last seven - ten years.
If you work hard to reestablish your credit rating, what you did a few years ago weighs less against you. In order to improve your credit scores, you must pay all bills on time. Don't max out any open lines of credit you have. If you want to buy a house or a car, save up a down payment.