How can I prevent another miscarriage from happening?

Depends.. This depends largely on your pregnancy history and if there is a cause that can be identified. See a physician for a complete history and physical evaluation.