Thanks for your query.
Your previous two ectopics would definitely affect your fertility.
This is because you might have suffered fallopian tube
damage / blockage.
Also, your partner's semen analysis
At 40, you might be having problems ovulating, so your ovarian reserve
needs to be tested.
Tubal factors are tested by a laparoscopy
I would suggest consulting a Fertility specialist, and going for a laparoscopy, and then proceeding for ART ( assisted reproductive technologies ) as advised.