Strange OnCurrent error

M

markmarko

So, I added an OnDirty Event to a control on my SalesOrder form. Now, all of
a sudden, I'm getting an error regarding the forms OnCurrent Event, which was
working fine up until 5 minutes ago.

The forms OnCurrent Event is an [EventProcedure]. I've changed the name of
the procedure, used the ... button to create a fresh one, copied code into
it, deleted the old one, and it still gets the error.

I've also made it so that procedure only has a msgbox in case there was an
error with the code, to no avail.

Any ideas what can cause this?
 
M

markmarko

Yes, sorry. I just thought of that myself.

Here's the error message:
"The expression On Current you entered as the event property setting
produced the following error: Procedure declaration does not match
description of event or procedure having the same name.

* The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure]
* There may have been an error evaluating the function, event, or macro.

This error occurs when an event has failed to run because Microsoft Office
Access cannot evaluate the location of the logic for the event. For example,
if the OnOpen property of a form is set to =[Field], this error occurs
because Access expects a macro or event name to run when the event is fired."
 
D

Dirk Goldgar

markmarko said:
Yes, sorry. I just thought of that myself.

Here's the error message:
"The expression On Current you entered as the event property setting
produced the following error: Procedure declaration does not match
description of event or procedure having the same name.

* The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure]
* There may have been an error evaluating the function, event, or macro.

This error occurs when an event has failed to run because Microsoft Office
Access cannot evaluate the location of the logic for the event. For
example,
if the OnOpen property of a form is set to =[Field], this error occurs
because Access expects a macro or event name to run when the event is
fired."

I suggest you post the code you have for both the Curret event and the Dirty
event. If it bothers you, posting just the Sub header lines will probably
be enough.
 
M

markmarko

The On Current code had all been put into comments (behind single quote
mark), and just msgbox ("On Current") remained.

The dirty had a similar msgbox for debugging, with no other code.
 
D

Dirk Goldgar

markmarko said:
The On Current code had all been put into comments (behind single quote
mark), and just msgbox ("On Current") remained.

The dirty had a similar msgbox for debugging, with no other code.

That's not the information we need. The error message says the procedure
header -- the "Private Sub Form_Current" or "Private Sub Form_Dirty" line --
is wrong. If the error message is correct, those are the lines we need to
see. It doesn't matter what's between the "Sub" and "End Sub" lines; it's
the "Sub" lines themselves that are i question.
 
D

Dirk Goldgar

markmarko said:
Private Sub Form_Current()

End Sub
--------------
Private Sub AssociatedCustAcct_Junction_Dirty(Cancel As Integer)

End Sub
--------------

The sub lines are the ones that were auto-generated by access when I
clicked
the "..." button on the event.


I don't see anything wrong with those. I wonder if your database has been
corrupted, or if maybe something else in the code module is causing a
compile error that is being misreported. Before chasing the corruption
possibility, check to make sure you don't have duplicate event procedures --
two Form_Current procs, or two AssociatedCustAcct_Junction_Dirty()
procedures.
 

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