As answered by @HansUp:
You have an ACCDB database which contains the form and VBA code you showed us. That database has the Microsoft Office 16.0 Access Database Engine Object Library reference checked. When you change the declaration to Dim MyRsMF As DAO.Recordset, that line triggers the compile error 'User-defined data type not defined'.
Test that code in a new ACCDB. If it works there, your older ACCDB may be corrupt.
Decompiling was indeed found to resolve the OP's issue.