Invalid Procedure Call on Forms

M

Mariah

Hello, any suggestions are appreciated!

I imported tables from our media database into our membership database. I
was going to combine the information so that I could streamline orders with
lookup fields but my supervisor didn't like it so... I went back to the
media database and now NONE of the form buttons are working.

The forms open, and all the reports, queries, and tables open without
incident.

However, when I click any button on any form (to call up a report, query or
another form), I receive an error: "Invalid Procedure Call or Arguement".

I tried creating a new form from scratch but the buttons still don't work.

The other database, our main database, works just fine. All is well on that
end, both databases are stored on the same computer network.

When the debugger opens, there is no code showing. There is an area labeled
"immediate" on the bottom of the screen. I do see the code if I open the
project and click on the forms. Here is a sample:

Private Sub cmdMedia_Click()
On Error GoTo Err_cmdMedia_Click

Dim stDocName As String

stDocName = "rptMedia"
DoCmd.OpenReport stDocName, acPreview

Exit_cmdMedia_Click:
Exit Sub

Err_cmdMedia_Click:
MsgBox Err.Description
Resume Exit_cmdMedia_Click

End Sub

On another note, I am of the mind that everything we do should be in one
database and our switchboard should make it easy for people to access any
information needed. Is this a standard and prudent viewpoint or should there
be separation? These forms are working well on the main database but I guess
I have to accept that my supervisor has the final say...
 
A

Allen Browne

Mariah, I'm not sure what specifically is causing your error, but here's a
standard sequence that fixes a whole raft of possible causes.

Follow these in order:

1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
In Access 2007, it's:
Office Button | Access Options | Current Database | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

2. Compact the database:
Tools | Database Utilities | Compact/Repair
or in Access 2007:
Office Button | Manage | Compact/Repair

3. 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"

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

5. 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

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

7. Still in the code window, choose Options on the Tools menu. On the
General tab, make sure Error Trapping is set to:
Break on Unhandled Errors
and the Compile on Demand is unchecked.

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,
the code syntax is compilable, and the VBA options are set to show errors
and avoid this kind of corruption.

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
 
C

Capt_Plutonium

All excellent suggestions by Allen - when this happens to me, it's
usually because of a corrupt record. I can pick it out quite easily
in the table because it has very strange characters (chinese, etc). I
can't delete the record right away - I have to compact and repair the
database. The repair won't fix the data in the corrupted record, but
it will let me delete it so I can keep moving forward.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top