Solomon hated all that he had worked for. That is a blunt statement, but he wrote it in Ecclesiastes 2. It would be more understandable if he had said he hated the work he had to do to get the stuff, but he said he hated the fruit of his labor. Still more puzzling, is his statement that he was concerned about what would happen to those things he had worked for. It seems that he hated these material possessions because he knew that they would pass from his control. Solomon was worried about the intelligence and character of the one who would come after him. Solomon was worried that the one coming after him would be not be wise. Solomon pointed out that giving a man something without his having to work for it is a negative thing.
Solomon concludes that even though he goes to bed tired, worn out from a hard day's labor, he cannot sleep. Sleep will not come because his mind refuses to rest. Why not? It could be because he has not been living righteously. It could be because he is stingy and greedy and cannot stand the thought of turning over the fruit of his labor to someone else. It could be because he has unfinished work that he is behind in, looming to greet him early the next morning. All of these may factor into the restless mind and the sleepless night. Which of us does not have such a testimony at least from time to time?
I think the real reason is revealed in verse 21. Legacy seems to be the key word. A man ultimately knows that his only real contribution to the world, his only real legacy, is in the lives he influences. Solomon has realized that he has failed in the real task at hand. He believes that he has toiled long and diligently with skill and wisdom; that part is good, but don't miss the next phrase. He says that he will give the fruit of his labor, his legacy, to one who has not labored with skill and wisdom. Now, whose fault is that? Solomon bears that responsibility. He has either failed to spend adequate time with his children, involving them in his work, or he has failed to teach them wisdom and skill and knowledge. Each of those is wrong and the blame must be laid at the feet of Solomon.
In the second case (failing to teach the wisdom, knowledge, and skill), many American parents fail in that regard. Parents ought to spend much time and effort in imparting wisdom, knowledge, and skill to their children. When I read in verse 21, Solomon lamenting the fact that he has not passed his legacy on to his children, I cannot keep from turning my thoughts to the legacy that ought to be every parent's number one concern; passing on the knowledge of God to their children. Parents ought to spend significant time and effort in ensuring that they bring their children up in the nurture and the admonition of the Lord.
By the time Solomon wrote Ecclesiastes, his opportunities had largely passed him by. He was a sad and disillusioned old man. He hated what he had gained from his labor; he declared all of life to be meaningless (until the end of the book when he acknowledged the meaning derived from living one's life for God); he could not even sleep at night. It does not have to be that way for you. Please do not wait for the end of your life as Solomon did, to discover the importance of leaving children behind who know the Lord and will work with knowledge, wisdom, and skill. It will be too late then, and sleepless nights will be your certain reward.