Access 2003 "Error Number 2455"

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

Who is Participating?
bokariaConnect With a Mentor Author Commented:
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.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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).
bokariaAuthor Commented:
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?

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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 */
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.