Requery a control on a subform

G

Guest

I have a form (answerCode) that displays options in a combo box (ACodes)
depending on the value of another control (Questions). The combo box
requeries when it obtains focus. This works fine.
When I imbed this form as a subform in another form (CreateC) the control
will no longer requery.
I have tried:
using a macro with requery of the control [only works on the original
form (answerCode)

creating an action even when the control has the focus:
[Forms]![CreateC]![answerCode].Form![ACodes].Requery {doesn't requery}

What am I doing wrong? The control shows the answer selections for the first
question and then continues to show the same answer selection regardless of
the question number.
Why does it work so well as a stand alone and falls apart as a subform?
Thanks - I need help!
 
G

Guest

[Forms]![CreateC]![answerCode].Form![ACodes].Requery

The syntax is okay, but where you have [answerCode], you should have the
name of the subform control on the form, not the name of the form that is the
source object of the subform control.
 
G

Guest

maybe I'm thick!
Do you mean replacing the subform name [answerCode] with the control name
[ACodes]. Because if you do I tried it and I get an error message.
I have:
the form [CreateC]
the subform [answerCode]
the control on the subform [ACodes] and it's here that I placed
the requery that requeries the data for the control only. The query itself
looks at another control on the same subform for criteria data.
Thanks
--
Have a great day!


Klatuu said:
[Forms]![CreateC]![answerCode].Form![ACodes].Requery

The syntax is okay, but where you have [answerCode], you should have the
name of the subform control on the form, not the name of the form that is the
source object of the subform control.

--
Dave Hargis, Microsoft Access MVP


Theresa said:
I have a form (answerCode) that displays options in a combo box (ACodes)
depending on the value of another control (Questions). The combo box
requeries when it obtains focus. This works fine.
When I imbed this form as a subform in another form (CreateC) the control
will no longer requery.
I have tried:
using a macro with requery of the control [only works on the original
form (answerCode)

creating an action even when the control has the focus:
[Forms]![CreateC]![answerCode].Form![ACodes].Requery {doesn't requery}

What am I doing wrong? The control shows the answer selections for the first
question and then continues to show the same answer selection regardless of
the question number.
Why does it work so well as a stand alone and falls apart as a subform?
Thanks - I need help!
 
G

Guest

I got a little confused, so I need to get something clear.

Okay, the form is named [CreateC]
On the form [CreateC] the subform control is named [ACodes]? or is [ACodes]
a control on the form that is the source object of the subform control on
[CreateC]?

Here is the order:
Form-> SubformControl->Form-> Control

Herein lies the confusion.
The form used as a subform is not what is referenced. This form is the
Source Object property of the subform control. It is reference by the word
Form. So to reference a control on the subform, the naming reference is as
above. So here is what you need to determine:

Form Name: [CreateC]
Subform Control Name:
Form Name of the Source Object of the Subform Control:
Name of the Control on the on form that is the source object of the subform
control:

--
Dave Hargis, Microsoft Access MVP


Theresa said:
maybe I'm thick!
Do you mean replacing the subform name [answerCode] with the control name
[ACodes]. Because if you do I tried it and I get an error message.
I have:
the form [CreateC]
the subform [answerCode]
the control on the subform [ACodes] and it's here that I placed
the requery that requeries the data for the control only. The query itself
looks at another control on the same subform for criteria data.
Thanks
--
Have a great day!


Klatuu said:
[Forms]![CreateC]![answerCode].Form![ACodes].Requery

The syntax is okay, but where you have [answerCode], you should have the
name of the subform control on the form, not the name of the form that is the
source object of the subform control.

--
Dave Hargis, Microsoft Access MVP


Theresa said:
I have a form (answerCode) that displays options in a combo box (ACodes)
depending on the value of another control (Questions). The combo box
requeries when it obtains focus. This works fine.
When I imbed this form as a subform in another form (CreateC) the control
will no longer requery.
I have tried:
using a macro with requery of the control [only works on the original
form (answerCode)

creating an action even when the control has the focus:
[Forms]![CreateC]![answerCode].Form![ACodes].Requery {doesn't requery}

What am I doing wrong? The control shows the answer selections for the first
question and then continues to show the same answer selection regardless of
the question number.
Why does it work so well as a stand alone and falls apart as a subform?
Thanks - I need help!
 
G

Guest

Thanks Dave, but I still don't know what it is I need to do (ie what 'name'
goes in the unknown position:

Form >SubformControl >.Form. control
[CreateC] > ? >.Form [ACodes].value

The main form is called: CreateC
The Subform name is called: AnswerCode
The control on the Subform is called: ACode

The only other intermediate control is the tab page that the subform is
sitting on (page 2 of TabCt10)

When the subform is not part of the main form the following correctly occurs:
*user moves form records to the desired question (combo box 6)
*the combo box [ACode] receives focus by user and requeries the underlying
query that provides code for the specified question only. This is not the
underlying table for the form, only the underlying table for the combo box
[ACode].
Everything works fine and the criteria for the query is:
[Forms]![AnswerCode]![Combo6].value

Now, when this form [AnswerCode] is placed onto tab page 2 on the form
[CreateC] as a subform (link is identifier of CreateC and identifier on
AnswerCode), the criteria in the query can not refresh the data in the combo
box [ACode]. Either the same code remains for all the data or no code at all.

Everything that you have said so far I have tried, but I must be doing
something fundamentally wrong and it's driving me insane!

Thanks
Theresa
 
G

Guest

I was not aware there is a tabbed form in play here. Since I haven't used
one in a while, I am not sure what references are necessary. I'll have to do
a little research and get back to you.
 

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