Form Won't Open
Posted on 2004-08-16
I have an odd problem. I'm writing some forms in my access database, and I can't open some of them. I don't mean that I can't get the to open with the DoCmd.FormOpen (which I can't do) but I can't even open them to display (only to design).
I've had a similar problem before, but it was that I had an extra end sub in the VB code. Getting rid of the erroneous line fixed the problem, but I can see no such problem this time.
The error code is 2501, and the error I get when I try to just open the form is:
"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.
*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."
Now, the entire amount of code for this form is as follows:
Option Compare Database
Private Sub Form_BeforeUpdate()
Controls("property_id") = Field(Me.OpenArgs, "|", 1)
Private Sub Form_Close()
Private Sub Form_Open(Cancel As Integer)
Dim stArgument As String
Dim stTest As String
stArgument = Field(Me.OpenArgs, "|", 2)
If Not IsNull(stArgument) Then
stTest = Left(Me.RecordSource, Len(Me.RecordSource) - 2) & " " & stArgument & ";"
Me.RecordSource = stTest
Even if I comment out all of the code, leaving just the declarations, I get the same thing. The properties for the OnOpen, BeforeUpdate and OnClose events are all set to [Event Procedure]. The OnOpen event code is the only code that is new since it stopped working, but even still this code works elsewhere in the program (though I must admit that every form similar to this one is breaking in the same way).
Is there something simple I'm missing?