Unanswered: error message about procedure declaration
Hi, I have made some updates to a table, incl. some VBA coding, and suddenly I get the following error when both opening forms, when switching between records, and (with a new reference to the before update property -but the same message) - when I try to safe a record.:
"The expression On Load 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."
It comes with some examples on the dialog as well:
"* 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."
I haven't done any changes to functions or macros since it worked last time.
I have checked all the controls I have made changes to this time around, plus the VBA code of the Form in question, and cannot see any conflicting names, nor have I made changes to the On Load procedure this time, and it all worked fine until the last changes. I have given a new name to the cbo_lead_person combo box, and have added txt to label and text field names to make them different from the control source name. But I cannot seem to see that there are any naming conflicts anywhere, especially since I havent used names with txt in them very much so any auto-generated names does NOT have those characters.
I have used compact and repair on the db, and restarted both access and the PC, but the error is still there.
Originally posted by M Owen
Go into the properties of the control in question and set the onload event then recompile.
Thanks for the recompile advice, that set me on towards the source of the problem, which is fixed now :-)
I hava a question related to my undestanding of events, coming from this fiddling. What I had done was this:
I had chosen to put a date field update on the got-focus event of an option control (part of an option group). When making the event, I used the (...) button on the property sheet, and chose Code. The event was then automatically called Something_gotfocus(). Nothing inside the parenthesis for this event.
Then I thought, no, I want this action on the mousedown event of that control instead. What I did was to only rename the subs: Replacing gotfocus with mousedown in the code. I did not realize that the latter demands parametres/specifications inside the parenthesis..., which I would have gotten automatically if I recreated the events through the property sheet's (...) button. The event was automatically shifted down to the mousedown event in the properties, so I was happy...
Now, a bit "wiser", I have recreated the optiongroup, all seem to work, but I am uncertain about putting the code on (just) that event (heh)...
I have one date field corresponding to each option in the group. Whatever choice is made, I want a date stamp with today's date in the corresponding date field.
However, I do NOT want the date set when the user is using the keyboard to shift two options down... The one in the middle should not have the date updated while the focus is passing by. But I still want to enable the user to use the keyboard instead of the mouse...
So now I am thinking that I can stick to the mouusedown but also set an if check on the very optiongroup itself as well.
But which event to use? I want to check if the tick mark in the group has changed, then BOTH write todays date in the corresponding field, and save the option control's value (the latter is automatic, but I cannot seem to find out where that action is really happening, where is the pointer to the field in the underlying query/table that will receive the changed option control value?
And: is this a good way at all? Any better ways of accomplishing this?