Why does this subform reference not work??

T

tlyczko

What is wrong with this subform reference??

I am calling it from the main form's Close event.

If Me!fsubIncidentConsumers.Form.RecordsetClone.RecordCount < 1 Then

I have had exactly the same kind of code work correctly in another
Access database, I am getting errors about invalid references to the
property Form/Report.

I have double-checked that I am referencing the correct SUBform
*control*.

The referenced subform we have to make sure the person chooses a value
from the combo box on the subform, which is shown in datasheet view,
one field showing, other fields enabled.

Thank you, Tom
 
S

strive4peace

Once the close event happens, the data has already been
onloaded and you can't ask Access what it is ... try this on
the UnLoad event

sounds, however, like you really may want this on the
BeforeUpdate -- BEFORE it writes changes to a record

Warm Regards,
Crystal
Microsoft Access MVP 2006

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 
T

tlyczko

Hi Crystal...

Thanks for responding.

After struggling with it for hours I discovered that when I had copied
that code from one database into the current one I'm using I put it
into the wrong event, I should have copied it into AfterUpdate, and I
put it there for now.

I will at some point try it out in BeforeUpdate as well, but I think
yesterday when I tried to test subform values or set focus to the
subform in BeforeUpdate, I got errors about not being able to set focus
to the subform, I don't recall now, I'll wait and see what happens.

Thanks, Tom
 
S

strive4peace

You're welcome, Tom

To better understand the events, press F1 in an event
property -- this gets you into context-sensitive help.

Pressing the F1 key on the property sheet in any property
you don't understand (but seems useful :) ) is a great way
to learn.

Understanding what triggers events and the order in which
they execute is very important

Warm Regards,
Crystal
Microsoft Access MVP 2006

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 

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

Similar Threads


Top