?
Solved

Access 2003 "Error Number 2455"

Posted on 2009-02-20
5
Medium Priority
?
625 Views
Last Modified: 2012-05-06
Hi,
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

0
Comment
Question by:bokaria
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:jmoss111
ID: 23691604
0
 
LVL 85
ID: 23691741
To expand on the link Jim has posted:

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

Me.NameOfYourSubformCONTROL.Form.ControlPropertyEtc

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).
0
 

Author Comment

by:bokaria
ID: 23694024
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?

0
 
LVL 85
ID: 23694084
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 */
0
 

Accepted Solution

by:
bokaria earned 0 total points
ID: 23708044
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.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

840 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