Hi Joshua,
Thanks for sharing the resolution with us :- )
Sincerely,
Alick Ye, MCSD
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| From: "Joshua A. Booker" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
|
| Hi Everyone,
|
| After further testing I found that the public sub was resetting the source
| object of the sub form from which I called it, so the form closed and
| reopened thus losing the reference to the Me object. I find it suprising
| that Access allows this to happen while code is running behind a form.
|
| Thank you to all who offered suggestions.
|
| Josh
|
| | > Hi Joshua,
| >
| > I did a test, the issue does not occur.
| >
| > 1. Create a new database with two forms.
| > 2. Form1 with one button and text box, and Form2 with one textbox.
| > 3. create a sub in form2
| >
| > Public Sub test()
| >
| > Debug.Print "hello"
| >
| > End Sub
| >
| > 4. In form1 button click event, call the code:
| >
| > Private Sub Command0_Click()
| >
| > Me.Text1.SetFocus
| >
| > Form_Form2.test
| >
| > Me.Text1.SetFocus
| >
| > End Sub
| >
| > There is no error. I am using Access 2002 with Windows XP Professional.
If
| > you have repro steps, please feel free to let me know.
| >
| >
| >
| > Sincerely,
| >
| > Alick Ye, MCSD
| > Microsoft Online Partner Support
| >
| > Get Secure! -
www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| >
| >
| >
| >
| > --------------------
| > | From: "Joshua A. Booker" <
[email protected]>
| > | Subject: 'Me' object no longer set
| > | Date: Wed, 13 Aug 2003 12:36:22 -0400
| > | X-Tomcat-NG: microsoft.public.access.modulesdaovba.ado
| > |
| > | Hi,
| > |
| > | The following error ocurrs after I call a public sub on another form,
| then
| > | try to refer to the calling form using the me keyword.
| > |
| > | Runtime Error 2467: 'The expression you entered refers to an object
that
| > is
| > | closed or no longer exists'.
| > |
| > | For Example:
| > |
| > | Private Sub Button_Click()
| > | Me.Textbox1.SetFocus 'this line would not cause error
| > | Form_OtherFormName.PublicSubName ' this code runs fine
| > | Me.Textbox1.SetFocus 'this line would cause error
| > | End Sub
| > |
| > | I assume the me object got lost when I called the other form, how do I
| > | prevent this or reset the 'Me' object?
| > |
| > | TIA,
| > | Josh
| > |
| > |
| > |
| >
|
|
|