Event Procedures Stopped Working

G

Guest

All the form coding I have written suddenly stopped working. Now every time I do something which will start an event procedure I get this message: "Procedure declaration does not match description of event or procedure having the same name." This happens even for procedures as simple as displaying a dialog box. They used to all work perfectly but somewhere along the line I did something that killed them. The actual code hasn't changed just the table and form designs. I am using Access 2000 with Visual Basic. How can I fix this? If anyone wants to look at my database I can email it to them.
I can't tell what has changed that would affect this.
 
A

Allen Browne

1. Press Ctrl+G to open the Immediate window.

2. Choose Compile from the Debug menu.
Access will highlight the problem code.

3. Fix the problem, and repeat until the code compiles.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kyle Rhoades said:
All the form coding I have written suddenly stopped working. Now every
time I do something which will start an event procedure I get this message:
"Procedure declaration does not match description of event or procedure
having the same name." This happens even for procedures as simple as
displaying a dialog box. They used to all work perfectly but somewhere along
the line I did something that killed them. The actual code hasn't changed
just the table and form designs. I am using Access 2000 with Visual Basic.
How can I fix this? If anyone wants to look at my database I can email it to
them.
 
G

Guest

The problem is with all event procedures. The error message appears as soon as each procedure is called. The debugger stops on the line with the procedures name.
 
A

Allen Browne

1. Compact to get rid of any old deleted code:
Tools | Database Utilities | Compact.

2. Open a code window, and choose:
Tools | References
Make sure none are marked "MISSING", and you do not have any references you
don't need. More on references:
http://allenbrowne.com/ser-38.html

3. Now, try a compile:
Debug | Compile
When it fails, search for another procedure that has the same name, in the
same module:
Edit | Find

4. If that does not find the culprit, search for a procedure with the same
name anywhere else in any module. If the other procedure does not use the
"Private" keyword, you may have found the culprit.

5. If that still does not identify the culprit, double-check that the
procedure has the correct arguments assigned. For example, if you have:
Private Sub Form_BeforeUpdate()
that will cause the error, because this particular event procedure should
have the argument "Cancel As Integer".


If that still does not solve the problem, the database is partially corrupt.
To rebuild it, try this sequence:
1. Using Access 2000, create a new (blank) database:
File | New

2. Immediately, uncheck the Name AutoCorrect boxes under:
Tools | Options | General.
For an explanation of why, see:
http://allenbrowne.com/bug-03.html

3. Import everything from the problem database:
File | Get External | Import

4. Deselect the references you don't need.

5. Compile the application.


--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kyle Rhoades said:
The problem is with all event procedures. The error message appears as
soon as each procedure is called. The debugger stops on the line with the
procedures name.
 

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