On SubForm2 there is a cmdButton that opens up frmContactAdd. I am
trying to requery Combo1 on SubForm2 from the Close event of
frmContactAdd. Should have said that in the first place!!!!
1) What is the syntax to reach the Combo from there?
Forms!mainform.subform2.Form.combo1.Requery
2) Is there a better/more correct way to do that?
It is almost always better to leave a form ignorant of how
it is used by other forms. In this case, open frmContactAdd
in dialog mode so the code in the button's Click event
procedure pauses until frmContactAdd is closed (or made
invisible). See VBA Help - OpenForm for details.
The requery can then be in the button's code instead of in
frmContactAdd. This way, frmContactAdd does not need to be
aware of the main form/subform arrangement and will not have
to be modified if the main form/subform arrangement is
changed. Also, frmContactAdd can be used by other forms
without complex logic to figure out what needs to done on
the form that opened it.
I can't find very much info either on the we or in the various ref
books I have. Could you point to any resource (other than the "refer
to forms/subforms from the access web site). It doesn't address the
extra form.
This info is inherent in the Forms part of the Access Object
Model. It can be found by searching for Object Model in
Access Help, which links tohttp://msdn.microsoft.com/en-us/library/aa210667(office.11).aspx
That info can be confusingly abstract until you begin to get
a grip on the concept of objects, properties and methods.
Your local library might provide a useful tutorial on object
oriented programming if you can wade through all the
theoretical stuff and get down to just the basics we use in
Access.
--
Marsh
MVP [MS Access]- Hide quoted text -
- Show quoted text -