I came across a problem this morning where my DB code would display the error: "The expression On Load you entered as the event property setting produced the following error: Procedure declartion does not match description of event or procedure having the same name." as described in post thread702-1387305.
As I was able to find others with the same problem, but nothing which assisted me in fixing it, I was left to my own devices. However, I believe that I have found the solution and would like to share it with others. Please let me know if you find this helpful.
Now, to replicate this problem, I used the following code:
In the above code, I had made a seemingly simple change... I had modified the original org_System_Exit event to read org_System_Enter as I wanted the code to trigger when entering the control instead of leaving it.
Now, the error states that the On Load procedure is calling the error, which I believe is what has lead to so much confusion on this issue. Instead, I noticed that the above error was triggered due to the parameters following the Sub declaration, as the Enter event allows no parameters. I removed "Cancel as Integer" and all was well.
In summary, if you have the above error, check the rest of your code for unneccessarily declared parameters. This may just solve the issue for you.
Hope folks find it helpful!
J
As I was able to find others with the same problem, but nothing which assisted me in fixing it, I was left to my own devices. However, I believe that I have found the solution and would like to share it with others. Please let me know if you find this helpful.
Now, to replicate this problem, I used the following code:
Code:
Private Sub Form_Load()
If Nz(Me.OpenArgs, "") <> "" Then LoadForm
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Nz(Me.OpenArgs, "") = "NewRec" Then
UnloadForm (org_Name.Value)
End If
End Sub
Private Sub org_System_Enter(Cancel As Integer)
If Nz(org_System.Value, "") = "" Then org_System.Value = org_Name.Value
End Sub
In the above code, I had made a seemingly simple change... I had modified the original org_System_Exit event to read org_System_Enter as I wanted the code to trigger when entering the control instead of leaving it.
Now, the error states that the On Load procedure is calling the error, which I believe is what has lead to so much confusion on this issue. Instead, I noticed that the above error was triggered due to the parameters following the Sub declaration, as the Enter event allows no parameters. I removed "Cancel as Integer" and all was well.
In summary, if you have the above error, check the rest of your code for unneccessarily declared parameters. This may just solve the issue for you.
Hope folks find it helpful!
J