Access 2003 "Error Number 2455"

Posted on 2009-02-20
Last Modified: 2012-05-06
When we are trying to set properties of a subform in Access we get the following error message.

"Error Number 2455 occurred: You entered an expression that has an invalid reference to property Form/Report"

Please advice/help
strProjTypesSQL = "SELECT " _

                        & "[Form Name], " _

                        & "[View Name], " _

                        & "[Description], " _

                        & "[Major Projection Type], " _

                        & "[Proj Screen Info] " _

                        & "FROM [Projection Types] " _

                        & "WHERE (" _

                        & "([ID]='" & Me.cboDataType & "'))"


    rstProjTypes.Open strProjTypesSQL, gconARS, adOpenForwardOnly, adLockReadOnly


    'Load Subform

    [txtSubFormLink].ControlSource = "[ID]"

    [Projections Subform].SourceObject = rstProjTypes![Form Name]

    [Projections Subform].Form.RecordSource = rstProjTypes![View Name]  /*  Access throws error in this statement */

    [Projections Subform].Form.OrderBy = "[Underwriting Year]"

    Me![Projections Subform].Form.OrderByOn = True

Open in new window

Question by:bokaria
    LVL 18

    Expert Comment

    LVL 84
    To expand on the link Jim has posted:

    You must refer to an Access subform using syntax similar to this:


    Where "NameOfYourSubformCONTORL" is the name of the Subform Control on your Parent form, and may or may NOT be named the same as the form you're using as a Subform. So to set the Recordsource of your subform, IF the subform CONTROL in named the same as the form used as a subform (i.e. Projections Subform):

    Me.[Projections Subform].Form.Recordsource  = rstProjType("View Name")

    It appears, however, from where the error is thrown that you might be referring to your subform correctly (since an incorrect reference should have thrown an error on the line above where you indicate) so the question now is:

    Does rstProjType("View Name") return a VALID RecordSource item (i.e. the name of a Query, TAble or a valid SQL statement).

    Author Comment

    Tried all possible options as described in  the link. It didn;t work .
    rstProjType("View Name")  is returning a  table  

    Here is more information as shown in the code:   The issue is happening Access 2003,  same code works perfect in Acccess97.

    Main form has a sub form "Subform1"  ,  From main form setting SourceObject for sub form  to another sub form "Subform2"  and then setting the  RecordSource for  Projections Subform.Form.

    Can you share your thoughts?

    LVL 84
    Access 97 and Access 2003 are wildly different animals ...

    <Main form has a sub form "Subform1">

    Is "Subform1" the name of the Subform Control on the main form? That's the key ....

    You might also try setting the return from your recordset to a variable, then set that variable as the Recordsource:

    'Load Subform
    Dim sRS As String
    sRS =  rstProjTypes("View Name")
        [txtSubFormLink].ControlSource = "[ID]"
        [Projections Subform].SourceObject = rstProjTypes![Form Name]
        [Projections Subform].Form.RecordSource = sRS '/ rstProjTypes![View Name]  /*  Access throws error in this statement */

    Accepted Solution

    tried with the above changes and did not work.

    Can you explain with simple example, how to set  source object and recordsource dynamically in access2003.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Suggested Solutions

    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now