Ecclesiastes 3:12 (ESV)

12 I perceived that there is nothing better for them than to be joyful and to do good as long as they live;

The Preacher taught that life truly has meaning. The Lord holds everything in his hand. He ensures that in spite of people's plans and actions, through everything that happens, his plan is carried out. Once you have found peace in this, you will learn to enjoy life despite the many questions. This also includes learning to do good to other people.