Eccl. 2:24-26.
24 There is nothing better for a man, than that he should eat and drink, and that he should make his soul enjoy good in his labour. This also I saw, that it was from the hand of God.
25 For who can eat, or who else can hasten hereunto, more than I?
26 For God giveth to a man that is good in His sight wisdom, and knowledge, and joy: but to the sinner he giveth travail, to gather and to heap up, that he may give to him that is good before God. This also is vanity and vexation of spirit.

It is true that it is good for a person to enjoy the good in his labor. I love my work, although I’m now looking forward to retirement. I loved teaching. I enjoyed all the volunteer things I’ve done in the church over the years. I loved rearing our children to walk with God, to walk with the wise. I love seeing their children also following that path.
I don’t know exactly what Solomon meant when he said it is good for one to eat and drink. If he meant feasting and alcohol, then no, that is not good. But we do need to nourish our bodies to do whatever work God has provided us. And isn’t it a wonderful gift that God created the food we need to be delicious!
In verse 25, Solomon acknowledges that no one has more opportunity to eat and drink at leisure than he does. And then he acknowledges that God gives a good man wisdom, and knowledge, and joy. A sinner, however, can work hard to gather and amass great treasure, only to end up yielding it to someone else who is godly.
That last sentence, however is not always true. Many times, a sinner leaves his goods to other sinners; sometimes, a righteous man leaves his to other righteous people. We can’t always predict what our inheritors will do with what we have gained, and therein lies vanity and vexation of spirit.
Emptiness. Every time you see the word vanity in this book, replace it with the word emptiness. Solomon was so empty in his heart that he just assumed it was the natural lot of mankind. How sad.