Link to home
Start Free TrialLog in
Avatar of imaksu
imaksu

asked on

Module not found

On a form I create a button to open a form when I click I get the message "Module not found and the form is not opened.
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

This is generally *not* a good sign ... and is usually corruption that may be able to be fixed by a repair service.  You can try a Compact & Repair ... but not likely to work.

You can also try importing all objects into a new MDB ... except for the corrupted form/module ... then recreate the form.

mx
I think it is missing refference that file is using, try to design the form then view it's code  then click tools- references and see if any thing in the list is missing, notice the dll or ocx file it is using and check if it is missing from your file system, sometimes you can uncheck it and it will work if it is not used on your form
Avatar of pseyler
pseyler

Both of these guys are right, and to identify the specifics of the problem, you might need to see exactly what part of your button code is causing the error.  Different versions of access produce different "automatic" button scripts with their wizards.  In the VBA editor for that button code, press F9 on the first "executable" line of the code (not a Declaration statement) to set a debug BreakPoint.  Then when you click your button, Access will open the editor on that line and you can press F8 to step through the code and see what actual line is triggering the error message.  That could help you identify your specific problem.

When you're done, don't forget to go back to the VBA editor and toggle OFF the breakpoint (the highlighting will go away) so your code won't always stop at that point.
"Both of these guys are right, "

Well ... not exactly.  The problem here is ... the Form *cannot* be opened because of this error.  

So ... "try to design the form then view it's code" ... is not going to happen because the form cannot be opened.  In fact, it may not be possible to open any code ... 'depending'.  The entire mdb may be corrupted or just one form.   You're not going to be able to single step through any code.  Remember what the error is sayL

"Module Not Found"
              ^^^^^^^^^

mx
Sorry I wasn't more specific.  First, I should have said "both of these guys COULD be right.

Now to the initial post...If I'm reading this right, there is a button on Form1 that calls code to open Form2.  When you click the button on Form1, then you get an error message.  

I'm assuming, perhaps incorrectly, that Form2 CAN be opened on its own through the Database window.  Is that true or false?

I'm also assuming that the error takes place while executing the code on Form1, which clearly can be opened, or you could click the button to trigger it.  Is this true or false?

So now the problem is POSSIBLY that the VBA module for Form1 is missing.  In that case, you'll learn something by opening the VBA editor and looking for it.  If it's gone (e.g. "not found" then you've definitely got MX's corruption issue.  Depending on your add-ins, access version, wizards, etc. you could also have something in your button code that is calling another module that is not found.

Either way, the first step is to attempt to view the VBA code for Form1.  Either you can, or you can't, and it's going to be diagnostic either way.
"Is that true or false?"
It probably cannot be opened from the db window.

The form most likely shows in the DB window ...

mx
SOLUTION
Avatar of pseyler
pseyler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of imaksu

ASKER

Thank you  all for comments: Action sequence for info:
1 Db opens --> Logon with shift pressed
2 Click on Form1 --> Form 1 opens
3 Click on Button 1 for Form 2 --> "Module Not Found"
4 Click on OK --> Vba code appears. On Vba page code for the button seems normal but the cursor is on the top line "Option Compare Database" instead of being in the area for button subroutine.
5 Close Vba code --> "This command will stop the Debugger."
6 Click on Form 2 --> Form opens normally, showing data.
Thanks  
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I can't recall a time when 'module not found' was anything other than corruption.

mx