Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Procedure Declaration Does Not Match Description of Event or Procedure

Status
Not open for further replies.

kevinlong

Programmer
Mar 23, 2007
6
GB
MS Access is driving me insane. For seemly no reason I get the following error message when I try to load the main form in my Access DB: -
"The expression On Open 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".

Having browsed the Tek-Tips forum for a few hours I've found other people have had the same error where the sub routine name is used more than once or if the sub routine was not created by using the ... button on the On Open event list (from the form properties events list). But this isn't the case here.
1) The routine was created using the .. button.
2) The name of the routine is used only ONCE.
3) I've tried deleting the module attached to the form and re-entering the data
4) I've tried delting the specific On Open sub routine and any reference to it, re-creating it using the ... button and pasting back in the lines of code between the sub declaration and the end sub marker.

All of the above have done nothing to fix the problem.
The offending bit of code is listed below...

Private Sub Form_Open(Cancel As Integer)
Dim AdUsers As New ADODB.Recordset
fail_count = 0
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_del"
DoCmd.OpenQuery "qry_copy"
new_active = False
DoCmd.SetWarnings True
AdUsers.Open "SELECT * FROM tbl_Admins", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
AdUsers.MoveFirst
Admin = False
Admin_Mode = False
While Not AdUsers.EOF
With AdUsers
If AdUsers!UserID = fOSUserName Then Admin = True
AdUsers.MoveNext
End With
Wend
HToolBars
data_entry = False
If Admin = False Then
box_Admin.Visible = False
lbl_Admin.Visible = False
btn_Email.Visible = False
btn_Tools.Visible = False
frm_boolean.Visible = False
lbl_Update.Caption = "SUBMIT CALL"
Else
box_Admin.Visible = True
lbl_Admin.Visible = True
btn_Email.Visible = True
btn_Tools.Visible = True
frm_boolean.Visible = True
DoCmd.OpenForm "frm_tools", acNormal
lbl_Update.Caption = "SAVE / UPDATE"
End If
ErrorDate_Label_DblClick
frm_boolean = 1
End Sub

The reason why I say this appears to happen for no reason is because this sub routine always used to work (this is about the 50th incarnation of this horrible DB). The only change to the code that messed up the execution was the call to the routine "ErrorDate_Label_DblClick" on the 3rd to last line, and said line of code has been commented out, removed, re-typed, cut/pasted and swore at all to no avail in my attempts to get rid of this error message. I have a backup of this DB where this line of code doesn't exist and neither does the routine it calls. I've checked the routine several times and can't see anything wrong with it (it works if ran in isolation).

Any help is much appreciated.
 
I suggest that you try a decompile, and if that does not work, import everything into a new database. I suspect you will need option 2.
 
try using Call ErrorDate_Label_DblClick

also, check that there's only one instance of this subroutine in your database

--------------------
Procrastinate Now!
 
Crowley16 - There is definitely only once instance of this sub routine in the module. Also using the "call" command makes no difference.

Remou - I've actually gone as far as printing off the module from the current DB and the backup DB (the backup works for some reason) and compared the two for differences and where there are any they shouldn't make a difference as they're in non-related sub-routines. I've tried compiling the DB from the Debug menu and now its coming up with the same error on other sub-routines in modules that have always worked before today!!! Looks like I'm going to be re-writing the damn thing as you said. :(

Thanks for your help guys.

 
Remou - Decompile did nothing (followed the instructions on the url link). Well even re-importing the forms and modules is not something I'm looking forward to. Think I'll do it on Monday as I'm off now til then. Thanks for the help
 
I'm wondering if you have a public sub called Form_Open.

Anyways, importing all objects into another database takes less than a minute.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top