I am sorry to hear you're not able to get over the miscarriages. I'm sorry to hear you feel infertile. Once when I miscarried twins, I asked the doctor (the ultrasound had shown their hearts had stopped beating) what would happen if the hearts began beating again (this was a very naive question of course, since that doesn't happen, but he was aware of how distressed I was and didn't sneer at me for being stupid or anything). What he did say, that sounds possibly cruel but helped me, was "You wouldn't want those babies." His point was, there is so much development happening at every second at that time in an embryo's growth that if something irregular happened even for just a day or two, there would be so much damage that the baby would be impossibly impaired. My feeling when someone at age 40 miscarries is that the embryo, for reasons of its own (not because of the mother), was not viable. It might have had what it needed to begin, but it didn't have everything it needed to continue. This doesn't mean you are infertile, it means nature took care of a try that was not going to work. I hope that doesn't sound hard-hearted, I know how much it aches. But I do want you to know it is not you, it is the cells in the embryo, that causes a miscarriage. I don't know why we get these wonderful starts full of hope only to have them leave this earth before we ever get to meet them. I have had four miscarriages, and now think of them as stars in the sky, who came for the purpose of giving me great joy but for only a short time.
Please don't think it is hopeless. At 40, because of the age of the eggs there is an increased chance of problems, but you probably knew that already even before getting pregnant. But it does not mean every pregnancy for a 40-year-old woman is a failure.
Try to have hope. If you cannot get past it, PLEASE see a counselor. My doctor set me up with a social worker who is connected with his practice, who counsels couples dealing with infertility, and it was the best thing I ever did. I cried all through the first session with her and could hardly even tell her my story, but I did get it out, and it helped immeasurably.
Good luck, and take care.
I waited seven yyears, one misscarriage,three ectopic pregnancies and then when I stopped trying I got blessed with my son who is now ten. I can't have anymore kids thisiI wanted three.