Re: Module Not Found



That either indicates that you have some code running, or else that the code
is corrupt.

1. Close the database.

2. Start Access again, holding down the Shift key if you have anything that
automatically starts when you load.

3. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

4. Compact the database:
Tools | Database Utilities | Compact/Repair

5. Close Access. Make a backup copy of the file. Decompile the database by
entering something like this at the command prompt while Access is not
running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

6. Open Access (holding down the Shift key if you have any startup code),
and compact again.

7. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

8. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

At this point, you should have a database where the name-autocorrect errors
are gone, the indexes are repaired, inconsistencies between the text- and
compiled-versions of the code are fixed, reference ambiguities are resolved,
and the code syntax is compilable.

If it is still a problem, the next step would be to get Access to rebuild
the database for you. Follow the steps for the first symptom in this
article:
Recovering from Corruption
at:
http://allenbrowne.com/ser-47.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"WMorsberger" <WMorsberger@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2209EB0B-7A8E-4EDB-83DB-C15F117879D3@xxxxxxxxxxxxxxxx
When I do the compile, it doesn't show me what is wrong just gives me the
error messages "You canceled the previous operations" and "Module Not
Found"
It's not showing me where the error is occuring

"Allen Browne" wrote:

There is something else wrong here.

In the code window, choose Compile on the Debug menu.
Fix any issue that Access highlights.
Repeat until the code compiles okay.

"WMorsberger" <WMorsberger@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B9C5CCB6-98FF-44BD-9627-91FE502883B4@xxxxxxxxxxxxxxxx
I added the following:

Private Sub cmdCancel_Click()
Stop
If Me.Dirty Then
Me.Undo
End If
DoCmd.Close acForm, Me.frmReroutes_Report_By_Contact
DoCmd.Close acForm, "frmReroutes_Report_By_Contact"
End Sub

and when I try to press the button I now get this error:

The expression On Click you entered as the event property setting
produced
the following error: Invalid outside procedure

"Allen Browne" wrote:

The 4 lines of code go into the event procedure for your command
button,
instead of the 1 line in your original post.

The error message could be related to something else that is going on,
e.g.
another event that is still running (such as the Exit of another
control,
before Access moves focus to the button and starts processing its
Click
event.) To test that idea, add this line above the other 4:
Stop

Now when it runs, if Access stops on the line, you know the event is
working. You can then press F8 to single-step through the procedure
and
see
where the problem lies.

"WMorsberger" <WMorsberger@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:56AC61B1-1E9C-4C1A-8B0C-0047B3F63A82@xxxxxxxxxxxxxxxx
where exactly am I putting that - I opened up VB going through the
cancel
button that I was having the problem with. When i tried to type it
up
I
still kept getting the error message "You canceled the previous
operation"
Because I am really new at this I don't have a clue :) This is
what I
was
typing

If Me.Dirty Then
Me.Undo
End If
DoCmd.Close acForm, Me.frmReroutes_Report_By Contact


"Allen Browne" wrote:

Something has gone wrong with the naming, or there is some other
operation
in progress.

Try undoing whatever is happening, and use the name that Access
knows
the
form by:
If Me.Dirty Then
Me.Undo
End If
DoCmd.Close acForm, Me.Name

"WMorsberger" <WMorsberger@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:3BDAF2B8-D95D-40A0-B1CB-5A7A963DE3A4@xxxxxxxxxxxxxxxx
I have written code for a cancel button that I have on my form -
when
I
close
VB and press the cancel button I receive the error message
"Module
Not
Found"


Here is the code that i have for the cancel button

Private Sub cmdCancel_Click()
DoCmd.Close acForm, "frmReroutes_Report_By_Contact"
End Sub



Now when i was typing the code in instead of getting the options
boxes,
example, when I typed DoCmd. I got an error message stating "You
canceled
the
previous operation"


.