Uncooked ham should last for up to 5 days in the refrigerator and cooked ham should last from 7 to 10 days in the refrigerator.
If you have uncooked ham and plan to keep it longer than 5 days then freeze it instead and frozen ham will keep for around 6 months to a year.
Cooked ham should also be frozen if wanting to keep it longer than a week or 10 days.