Subform Problem

C

Chaplain Doug

Access 2002. I have a subform of a subform which I need to
do the following to:

Forms![Update Student Records]![Update Student Records
subform]![Update Student Records subform2].Form.AllowEdits
= False

This works fine when the subsubform has data. But when
there is no data to display, I get the error:

Runtime error "2455"

You entered an expression that has an invalid reference to
the property Form/Report.

This error occurs with any reference to the subform when
there is no data in the subform display. Why?
 
B

Bryan Reich [MSFT]

My guess is that the subform of the subform doesn't exist unless the first
subform is populated, since if the first subform isn't populated, you will
have no data with which to query for the second subform. When you say there
is no data in the subform display, I assume you mean the first subform too?
If so then I think this is your problem. You will probably have to
conditionally check to see if the first subform exists before trying to use
it to access it's subform.
 
K

Kelvin

If the main Form doesn't have data then the subform does not exist,
therefore references to the subform are invalid. If the subform doesn't
have data, the sub-subform doesn't exist and therefore references to it are
invalid. If the sub-subform is empty, then references to controls and other
objects on the sub-subform are invalid.

In order to access the properties of the sub-subform, the subform must have
data, else the sub-subform doesn't exist. Just use an if statement to check
if the subform has data before setting the sub-subform's properties.

Kelvin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top