I have a form that I wrote an unload code for.
The code should do some checks before closing and closing may be cancelled.
Things are OK either I exit the form by the [x] control button or by a custom exit button.
However, when exiting the form by choosing "Design View" the following error occur.
Run-time error '2467'
The expression you entered refers to an object that is closed or doesn't exist.
Fortunately, I could regenerate the error with a tiny database that is attached.
Here is the form code:
Private Type Record
stID As Long
stName As String
stAge As Long
Private Sub DoSomthing()
Dim R As Record
R.stID = Me.st_ID ' The error occurs here and apparently it applies to the next two lines too.
R.stName = Me.st_Name
R.stAge = Me.st_age
Private Sub Form_Unload(Cancel As Integer)
I could not find something specific to my case on the net.
Your help is appreciated.