Syntax on Sync'd Subform

T

TeeSee

Is there a different syntax required to requery a combo on a sync'd
subform as opposed to the usual nested variety. I have

MainTable
subform1 (Nested)
Subform2 (Sync'd)
I am trying to requery the Comb1 on Subform2 on the Combo2 -
AfterUpdate event.

I've tried all I can think of with no result and would appreciate any
advice as to the proper syntax.

Thanks
 
T

TeeSee

Is there a different syntax required to requery a combo on a sync'd
subform as opposed to the usual nested variety. I have

MainTable
subform1 (Nested)
Subform2 (Sync'd)
I am trying to requery the Comb1 on Subform2 on the Combo2 -
AfterUpdate event.

I've tried all I can think of with no result and would appreciate any
advice as to the proper syntax.

Thanks

Obviously not awake yet. That should say
MainTable
subform1 (Nested)
Subform2 (Sync'd)
I am trying to requery the Combo1 on Subform2 after updating the table
which is the row source for Combo1.
Hope that makes more sense.
 
M

Marshall Barton

TeeSee said:
Obviously not awake yet. That should say
MainTable
subform1 (Nested)
Subform2 (Sync'd)
I am trying to requery the Combo1 on Subform2 after updating the table
which is the row source for Combo1.


Get another shot of caffine ;-)
Then tell us where/how combo1's table is updated.

If it's in the main form:
Me.subform2.Form.combo1.Requery

If it's in subform1:
Parent.subform2.Form.combo1.Requery

If it's in subform2:
Me.combo1.Requery
 
T

TeeSee

Obviously not awake yet. That should say
MainTable
subform1 (Nested)
Subform2 (Sync'd)
I am trying to requery the Combo1 on Subform2 after updating the table
which is the row source for  Combo1.

Get another shot of caffine  ;-)
Then tell us where/how combo1's table is updated.

If it's in the main form:
        Me.subform2.Form.combo1.Requery

If it's in subform1:
        Parent.subform2.Form.combo1.Requery

If it's in subform2:
        Me.combo1.Requery

--
Marsh
MVP [MS Access]- Hide quoted text -

- Show quoted text -

Thanks for the response Marshall.
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?
2) Is there a better/more correct way to do that?

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.

Thanks
 
M

Marshall Barton

TeeSee said:
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 to
http://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.
 
T

TeeSee

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 -

Marshall ... A sincere thanks for that very informative reponse. That
sorted immediate things out as well as food for thought.
Thanks again.
 

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