How can I stop being angry with God?

Can anyone help me? I don't know how to stop being angry with God. I'm almost 40 and we've been TTC for 2 years. Told my husband on fathers day he's finally going to be a dad. The baby measured 7 weeks yesterday (I'm 8 weeks) and had no heartbeat. The grief is unbearable and I'm so angry. Why does He allow so many of us go through this? Why??