Sunan an-Nasa'i, Book 25, Hadith 111 (In-Book)

It was narrated from Jabr that he entered with the Messenger of Allah upon someone who was dying, and the women were weeping. Jabr said: "Are you weeping when the Messenger of Allah is sitting here?" He said: "Let them weep so long as he is among them, but if he dies no one should weep for him."

أَخْبَرَنَا أَحْمَدُ بْنُ يَحْيَى، قَالَ حَدَّثَنَا إِسْحَاقُ بْنُ مَنْصُورٍ، قَالَ حَدَّثَنَا دَاوُدُ، - يَعْنِي الطَّائِيَّ - عَنْ عَبْدِ الْمَلِكِ بْنِ عُمَيْرٍ، عَنْ جَبْرٍ، أَنَّهُ دَخَلَ مَعَ رَسُولِ اللَّهِ صلى الله عليه وسلم عَلَى مَيِّتٍ فَبَكَى النِّسَاءُ فَقَالَ جَبْرٌ أَتَبْكِينَ مَا دَامَ رَسُولُ اللَّهِ صلى الله عليه وسلم جَالِسًا قَالَ ‏ "‏ دَعْهُنَّ يَبْكِينَ مَا دَامَ بَيْنَهُنَّ فَإِذَا وَجَبَ فَلاَ تَبْكِيَنَّ بَاكِيَةٌ ‏" ‏ ‏.‏

sunnah.com