• access 2007 runtime error 2476 the expression you entered refers to an object that is closed or doesn't exist

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » access 2007 runtime error 2476 the expression you entered refers to an object that is closed or doesn't exist

    Author
    Topic
    #462279

    I have a form with subform with subform.
    When I close the form or load the form I let the sourceobject filled in on a condition.
    I have attached a stripped version.
    The form is frmproject
    this is the line that gives the error:

    Forms!frmProject!frmProjectHidden.Form!frmProjectHiddenDeuren.Form.SourceObject = “frmProjectHiddenDeuren”

    I’ll hope that someone can help me.

    Kind regards,
    Nancy

    Viewing 3 reply threads
    Author
    Replies
    • #1176064

      Hi Nancy,

      It appears to me that you do not have a subform control anywhere on the main form that has a subform control named frmProjectHiddenDeuren – which is why your are getting the error. I also don’t understand the need for the nesting of subforms three deep – it appears there is nothing on the main form but the subform control frmProjectHidden – but that may be a result of you getting rid of things not necessary to understand the issue. Referring to subforms is always a bit tricky, especially if you are nesting them – it might help to give your subform controls a prefix that indicates it is a subform control and not a form bound to a subform control. Please post back if you conclude that isn’t the issue.

    • #1176067

      Forms!frmProject!frmProjectHidden.Form!frmProjectHiddenDeuren.Form.SourceObject = “frmProjectHiddenDeuren”

      Replace that line with

      Me.frmProjectHiddenDeuren.SourceObject =”frmProjectHiddenDeuren”

      This code is running within frmProjectHidden so Me refers to that form. Within that form there is a subform control named frmProjectHiddenDeuren.
      All you need to do is set the source object of a subform control to the name of a form.

      You have similar code in lots of places.

      • #1176069

        Sometimes I have trouble seeing the forest for all the trees!

    • #1176102

      I have tried it with Me.frmProjectHiddenDeuren.SourceObject =”frmProjectHiddenDeuren”
      but I still get the same error.
      if you would look at the attached database, you would see that there is a frmProjectHiddenDeuren!!
      The main form frmproject, is not yet completed, there will come a searchcombo field!
      There is a reason for the nesting with subforms.
      the first form frmproject = searchform witch will load frmProjectHiddenDeuren when there is one selected.
      the other subforms is because there are subtables
      tblproject has a subtable tblprojectdeuren and tblprojectdeuren has a subtable tblprojectdeurenpanelen.

      Can someone help me please, please open the file.

      Many thanks,
      Nancy

      • #1176103

        It worked for me when I made the change I suggested.
        But then I got the same error from another piece of code as you have similar expressions in lots of different places.
        So you need to change all of them.

    • #1176104

      Hello John,
      I got it working, just like you said, I have changed all with me. and it works fine now.
      I alsow changed the name from frmprojecthidden to subfrmprojecthidden. So it is more clearly now.

      Thanks alot.
      greetings Nancy

    Viewing 3 reply threads
    Reply To: Reply #1176067 in access 2007 runtime error 2476 the expression you entered refers to an object that is closed or doesn't exist

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel