What section 24 actually prohibits
Section 24: "A landlord shall not alter the locking system on a door giving entry to a rental unit or residential complex or cause the locking system to be altered during the tenant's occupancy of the rental unit without giving the tenant replacement keys."
Read it carefully — changing the locks is not banned. Changing them without handing over keys is. A landlord rekeying a building after a burglary is fine, provided every tenant gets a key.
"Or cause the locking system to be altered" catches instructing a locksmith or a superintendent to do it. You cannot delegate your way around the section.
It runs for the whole of the tenant's occupancy. Occupancy ends when the tenant actually leaves, not when a notice expires and not when an order issues.
Why a lockout is the expensive mistake
Section 39 restricts a landlord from recovering possession except in accordance with the Act, and section 40 abolishes distress — seizing a tenant's property for arrears. Between them, self-help is closed off.
Only the Sheriff enforces an eviction order. An order from the Board is not permission for the landlord to change the locks; it is an instrument the Sheriff acts on.
A lockout is also very likely to be a substantial interference with reasonable enjoyment under section 22, and it can look like harassment under section 23, which forbids a landlord to "harass, obstruct, coerce, threaten or interfere with a tenant". Those attract their own remedies on top of the tenant simply getting back in.
The arithmetic is unkind. A lockout to recover a month of arrears routinely produces an order worth several months of rent against the landlord.
The tenant's side, and the practical route
Section 35(1): a tenant "shall not alter the locking system on a door giving entry to a rental unit or residential complex" without the landlord's consent. If they do, section 35(2) lets the landlord apply to the Board for an order.
Apply rather than counter-change. A landlord who responds to an unauthorised lock change by changing it back without providing keys has now breached section 24, and the argument becomes about the landlord.
Section 25 is the frame for all of this: "A landlord may enter a rental unit only in accordance with section 26 or 27." Holding a key does not create a right to use it — entry still needs an emergency, consent at the door, or 24 hours' written notice.
Keys as a records problem
Log every key issued, to whom, and on what date, against the unit. Turnover is where key control quietly fails, and a lost master is a building-wide expense.
When you rekey, record that replacement keys were provided and when each tenant collected theirs. That record is the section 24 defence.
Section 134 prohibits a key deposit, so do not take money against a key's return. Recording who holds what is the substitute for a deposit you are not allowed to hold.