none
Error 2746 when going from form view to design RRS feed

  • Question

  • I have a form that is called by clicking on a record in a separate form. I have been asked to allow the user to go directly to this form. and add records. But when it is opened that way and they try to close it they get a error "2647 The expression you entered refers to an object that is closed or doesn't exist". My intension is if it is called close the calling form.

    Private Sub Form_Close()
    
        If Not CurrentProject.AllForms("Error_List").IsLoaded = False Then
            DoCmd.Close acForm, "Error_List"
        End If
    
    Exit_Current:
       
        
    End Sub
        
    

    Friday, April 27, 2018 7:16 PM

Answers

  • Hello Seeker of Wisdom,

    >>The line causing the error is...

    According to the error message, I would suggest you check if there is a form named "Error_List". Is there any typo?

    I tried to use a wrong name for testing and I got the same error. Of course, it works well if I use an correct form name.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 2, 2018 5:52 AM

All replies

  • You could put the below in the On Open event of the form you're opening.  So the opening form will close the form that called it:

    DoCmd.Close acForm, "Error_List"

    Should work fine if the form is open or not.  Don't really need to check if it is open.

    Mike
    Friday, April 27, 2018 7:43 PM
  • Hello Seeker Of Wisdom,

    I would suggest you set a break point and debug the code to find which line caused this error. Please remember to comment out other event code in case of their effects on the test.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Saturday, April 28, 2018 3:33 AM
  • Thanks for your responses. The line causing the error is

    If Not CurrentProject.AllForms("Error_List").IsLoaded = False Then

    I have examined CurrentProject.AllFormsand when the form is called from the form "ErrorList" it does have a entry. but when the form is opened directly there is no entry. I assumed the statement would just check if there was a open form but it appears it doesn't work as one might think. I am thinking the statement to close the form in the open event would need the same check to prevent the situation that would happen here if I attempted to close a form that was not open. But I am wondering if perhaps closing the form on exit from the calling form would work. I am going to try putting in a Try catch to bypass the abend.   

    Monday, April 30, 2018 1:38 PM
  • Hello Seeker of Wisdom,

    >>The line causing the error is...

    According to the error message, I would suggest you check if there is a form named "Error_List". Is there any typo?

    I tried to use a wrong name for testing and I got the same error. Of course, it works well if I use an correct form name.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 2, 2018 5:52 AM