It is funny (No that is absolutely the wrong word because it is very serious) that people get the wrong idea about the Ten Commandments and see them as something we must obey if we want to have any hope of salvation. Nothing could be further from the truth. From beginning to end the Bible speaks of God in His grace redeeming people as they are.
Look at the book of Exodus some time and you will see that God redeems a bunch of slaves and after He has saved them He gives them the Commandments. They are the beginning of the fulfilment of His promise to Abraham to make a people and a nation of His own.
Now you can see the Ten Commandment as the way He wants His people to behave once they are redeemed. The Ten Commandments are not about our salvation – but about our sanctification. And we will still struggle with them until we see the need of the Holy Spirit to help us. AND that failure is going to be a feature of our lives until we get to Heaven.