For me, yes, the failed attempt has served as a deterrent. Due to various intractable issues, my life has sucked for a long time. Adding more scars, more people thinking I'm merely crazy and more medical bills won't in any way enhance my life.
I don't want to survive another failed attempt and I'm usually in no position to make sure I succeed.
So, for me, yes, it's been a factor.
/Anecdata
I'm not confident that stopping someone would have the same effect as them living through it.
One way of threading this needle is to perform attempts which are obviously going to fail, maybe eben intentionally so.
It may take any kind of attempt, be it intentionally or accidentally unsuccessful to lead to treatment or at least the acknowledgement of all parties involved that the problem is actually bigger than a bout of self-pity or lack of character.