Subform control 'Form' property giving run-time error 2455

T

Trev Clarke

Hi there,

I'm having problems with writing an Access 97 database running under XP Pro.
When I try to use the .Form property of a subform control, I keep getting
"run-time error '2455': You entered an expression that has an invalid
reference to the property Form/Report".
I am using the control name and not the subform name. I have also seen
messages on these and other forums where others seem to be having similar
problems (sometimes with other properties of subform controls), but the
helpful expert seems to always end up stumped.
It seems to have the hallmarks of an incompatibility problem where a dll or
whatever has been updated by windows or something else - but I have no idea
which ones to check (or how) and would really like to avoid a complete
rreinstall if possible.
All help and advice will be gratefully received.
Thanks,
Trev.
 
B

Brian

Trev Clarke said:
Hi there,

I'm having problems with writing an Access 97 database running under XP Pro.
When I try to use the .Form property of a subform control, I keep getting
"run-time error '2455': You entered an expression that has an invalid
reference to the property Form/Report".
I am using the control name and not the subform name. I have also seen
messages on these and other forums where others seem to be having similar
problems (sometimes with other properties of subform controls), but the
helpful expert seems to always end up stumped.
It seems to have the hallmarks of an incompatibility problem where a dll or
whatever has been updated by windows or something else - but I have no idea
which ones to check (or how) and would really like to avoid a complete
rreinstall if possible.
All help and advice will be gratefully received.
Thanks,
Trev.

I have often observed this in places such as the Current event for the main
form, and have come to the conclusion that it is a synchronisation issue
whereby Access is busy loading or otherwise operating on the subform and
hence it does not, at that moment, "exist" as an object that can be
referenced.

The solution could be as simple as just trapping and discarding the error,
but it really depends on where it is occurring and what you are trying to
do.
 
T

Trev Clarke

Hi Brian, Thanks for replying.
Mostly, the main and subforms work fine. Changing record on the main form
moves the subform to the first relevant record there. And the subform has an
unbound option group to select between those subrecords, which works ok.
I next tried adding a command from the main form to set the option group
back to its first value when a new main record is selected, and also tried to
add one to initialise a calculated control on the subform, again when the
main record changed. Both of these need to use the .Form property of the
subform control - and lead to the error.
As I have been using controls on both main and subform ok before the error
arises, I thought this meant both must be loaded/initialised/etc. But,
thinking about it, the common theme in both occurrences of the error so far
is that a new main record (and hence, a new set of subrecords) has just been
selected. Perhaps this causes some reinitialisation of the subform that is
causing the problem you suggest.
If this could be so, is there an event of the subform that I should be using
- one that triggers whenever the underlying data changes because of the link
master rather than because of user activity on the form? (Hope that makes
sense).
Thanks again for your reply (and hoping for more :eek:) )
Trev.

:
 
B

Brian

Trev Clarke said:
Hi Brian, Thanks for replying.
Mostly, the main and subforms work fine. Changing record on the main form
moves the subform to the first relevant record there. And the subform has an
unbound option group to select between those subrecords, which works ok.
I next tried adding a command from the main form to set the option group
back to its first value when a new main record is selected, and also tried to
add one to initialise a calculated control on the subform, again when the
main record changed. Both of these need to use the .Form property of the
subform control - and lead to the error.
As I have been using controls on both main and subform ok before the error
arises, I thought this meant both must be loaded/initialised/etc. But,
thinking about it, the common theme in both occurrences of the error so far
is that a new main record (and hence, a new set of subrecords) has just been
selected. Perhaps this causes some reinitialisation of the subform that is
causing the problem you suggest.
If this could be so, is there an event of the subform that I should be using
- one that triggers whenever the underlying data changes because of the link
master rather than because of user activity on the form? (Hope that makes
sense).
Thanks again for your reply (and hoping for more :eek:) )
Trev.

Hi Trev,

You didn't say so explicitly, but it seems from your description that the
problem is indeed occurring in the Current event for the main form.

Now, a peculiar thing about Current events is that they usually run twice
(strange but true, you can check it out for yourself by putting a
debug.print statement in the event code). So, when a problem like this
occurs, you can sometimes deal with it by, as I suggested before, simply
trapping and ignoring the error: what failed on the first execution of the
Current event may work on the second execution.

It's the first thing I would try.
 

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