This refers to Moodle 3.10 from August 2021 onwards
How to ensure students cannot self enrol on previous modules (e.g. on 14/15 modules)
If you want to allow self-enrolment on your module, it could be confusing to students if they self enrol by mistake on the previous year's module.
How not to do it
- Don't hide the previous module as this disadvantages last year's genuine students who should continue to have access to the modules they were taught
- Don't hide the self-enrolment instance altogether as this removes access for last year's self-enrolled students
- Don't delete the self enrolment instance as this unenrols any students who originally self enrolled
Prevent further self-enrolment
- Go into your module
- Click the 'Hamburger icon' on the top right
and click on 'Participants' 
- Click on the 'Cogwheel icon' and select 'Enrolment methods'

4. Look for the self-enrolment instance - the name might not include the words 'self-enrolment' (If there isn't a self-enrolment instance then you don't have any problems - no-one can self-enrol anyway).

Prevent further self-enrolment, while allowing existing students to continue to see the module.
- Click the settings icon (cogwheel icon on the "Self enrolment (Student)" row in diagram above)

2. Ensure 'Allow Existing enrolments' is set to 'Yes'
3. Ensure 'Allow new enrolments' is set to 'No'

Method 2
- Set the end date for self-enrolment as appropriate, e.g., to 30 June 2020 for 19/20 modules.

This ensures that students already signed up stay on the module and can view it, and no-one new can sign up.