Is there a formula to determine when to stop making repairs and purchase a newer vechicle?

After $ 5000.00 in repairs depending on the year of the vehicle, once your into $ 10,000.00 you may as well get another car or truck, if you can afford a newer vehicle, trade it in and take any vehicle that works, until you can afford a better vehicle, buy a used vehicle from original owner only. Alot of vehicles with 50,000 miles on it are still good cars if it from the original owner.