After using Access for years, now I'm back to my first years that I don't even understand how Compile behaves.
I have a form with a simple code in it's On_Open event :
And this is the function:
The db compiles and runs without error.
If I change the function as bellow, still the db complies without any error.
But at run time it returns an error, apparently because of Me. (Run time error:13 - Type mismatch)
Has Access been behaving this way all these years and I simply hadn't noticed? or is it a new thing?
Why the compile doesn't return any error?
thanks.
PS: A sample db is attached. Since I use a non-english version of office, you can not open my forms. I had to use one of Isladogs' databases posted here to show my case. Apologies to @isladogs for using his db as a test.
I have a form with a simple code in it's On_Open event :
SQL:
Private Sub Form_Open(Cancel As Integer)
SetTestMode Me
End Sub
And this is the function:
SQL:
Public Function SetTestMode(frm As Access.Form)
MsgBox "hi"
End Function
The db compiles and runs without error.
If I change the function as bellow, still the db complies without any error.
SQL:
Public Function SetTestMode()
MsgBox "hi"
End Function
Has Access been behaving this way all these years and I simply hadn't noticed? or is it a new thing?
Why the compile doesn't return any error?
thanks.
PS: A sample db is attached. Since I use a non-english version of office, you can not open my forms. I had to use one of Isladogs' databases posted here to show my case. Apologies to @isladogs for using his db as a test.
Attachments
Last edited: