Compile Error: Invalid Use Of Me Keyword

  • I recently found sample code online for a Student Registration Userform that I downloaded and modified for my needs. I was able to modify everything successfully to meet my needs with the exception of the "Search" function.

    To use the search function the user must enter a search term, such as a student's last name, click the "Search" button and all records matching the search term will be displayed in the corresponding listbox. However, this process generates the following error message, "Compile Error: Invalid Use Of Me Keyword". I have tried modifying the code in several ways, but always end up with the same error message.

    Any suggestions regarding correcting the code or even deleting the functionality the offending code references would be appreciated. See code below.


    "Me Error" is Line 31


  • Where did you put that code? It should be in the userform code module, not a regular module.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Rory -


    Your suggestion fixed the issue! Unfortunately, it appears to have caused a different error: when I attempt to edit and save a record I get the following error message, "Compile Error: Sub or Function Not Defined".


    The error occurs on Line 22


  • Post by moreoveraudit ().

    This post was deleted by rory ().

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!