(59) باب إِذَا هَمَّ الْعَبْدُ بِحَسَنَةٍ كُتِبَتْ وَإِذَا هَمَّ بِسَيِّئَةٍ لَمْ تُكْتَبْ
It is narrated on the authority of Ibn Abbas that the Messenger of Allah (ﷺ) transmitted it from the Blessed and Great Lord:
Verily Allah recorded the good and the evil and then made it clear that he who intended good but did not do it, Allah recorded one complete good in his favour, but if he intended it and also did it, the Glorious and Great Allah recorded ten to seven hundred virtues and even more to his credit. But it he intended evil, but did not commit it, Allah wrote down full one good in his favour. If he intended that and also committed it, Allah made an entry of one evil against him.
Reference: Sahih Muslim 131 a
In-book reference: Book 1, Hadith 245
USC-MSA web (English) reference(deprecated numbering scheme): Book 1, Hadith 237