This document may be helpful.
From page 39:
Virginia law provides that certain contracts not in writing are void as
to purchasers or creditors who have no notice of the contract. (Va. Code
Ann., § 11-1.) An oral contract for the lease of real estate for a term of
more than five years is void with respect to any innocent third party
purchasers or creditors unless the lease of 5 years or more is filed with the
land records in the court house. (Id.) For example, if a lease for a period of
over five years is not in writing and filed in the court house, a potential
purchaser has no notice of the lease. If Teddy Tenant is in the 3rd year of
the agreement and Billy Buyer purchase the farm from Lydia Landlord,
Teddy loses any rights under the lease. On the other hand, if the lease is
filled in the court house, Billy Buyer takes the land subject to Teddy
Tenant’s rights in the land. Any lease of more than five years must be filed
with the real estate records to be effective against third party purchasers.
The tenant would not be able to hold the new owner to the lease and the
tenant may have to vacate the premises.