Requery Question????

K

KC Classic

I have a form that changes with a parameter that is entered through a combo
box. The syntax of the parameter follows:

Forms!frmWhatState![cboStateCode]

This parameter is entered in underlying crosstab queries that supply my main
form named frmStateCriteria. In an effort to try to broaden the amount of
information supplied by this form, I have added tab controls and subforms to
the main form and the form now displays monthly/quarterly totals filtered by
the State Code. My form displays the correct result set and totals by state
as requested. The problem occurs when I change the State Code parameter in
my combo box. I change from say CA (California) to GA (Georgia) and main form
does not change as requested. The additional tabs that display the
monthly/quarterly information are not updated based upon the new State Code
criteria. I believe the problem has to do with the linking of my
forms/subforms but the reading I have done to date has further confused the
issue in my brain. I have tried to Requery using a macro but am not sure
where to run the macro - on the main form or my subform(s).

My goal is to have the monthly/quarterly totals update as the State Code
parameter is changed. Currently, the change will occur but only when the
main form is closed and reopened. I would like to be able to change the
parameter on frmWhatState and have the information follow suit on my main
form.

Anyone have any suggestions?

KC Classic
 
K

Ken Snell \(MVP\)

Do you requery that main form after you change the value in that combo box?
Use AfterUpdate event of that combobox:

Private Sub cboStateCode_AfterUpdate()
Forms!frmStateCriteria.Requery
End Sub
 
K

KC Classic

Ken,

Thanks for your response. Being a novice, I have determined that for the
multiple tab controls on my main form, not all of the information comes from
the same query. The initial tab control provides generic information related
to each state - state criteria if you will. This main page is linked to my
parmeter form and changes with each change in the State Code. However, the
other two tabs which show numerical data totals come from a different
queries. The subforms on those tab controls are linked to the proper
underlying query but understandably, do not change when the parameter state
code is changed as they are not linked to the main form.

Is there a way that when the State Code changes it updates the main form and
the subforms (which are based on different queries)? I might add the
subforms are based on crosstab queries that provide monthly and quarterly
data totals.

Your assistance is much appreciated.
 
K

Ken Snell \(MVP\)

If you requery the main form, and the subforms are linked to the main form
via the LinkMasterFields and LinkChildFields properties of the subform
controls, then the subforms also should "change" to conform to the requeried
main form.

What are the LinkMasterFields and LinkChildFields properties for all the
subform controls on that main form? What are the SQL statements of the
record sources of the main form and all those subforms?

--

Ken Snell
<MS ACCESS MVP>



KC Classic said:
Ken,

Thanks for your response. Being a novice, I have determined that for the
multiple tab controls on my main form, not all of the information comes
from
the same query. The initial tab control provides generic information
related
to each state - state criteria if you will. This main page is linked to
my
parmeter form and changes with each change in the State Code. However,
the
other two tabs which show numerical data totals come from a different
queries. The subforms on those tab controls are linked to the proper
underlying query but understandably, do not change when the parameter
state
code is changed as they are not linked to the main form.

Is there a way that when the State Code changes it updates the main form
and
the subforms (which are based on different queries)? I might add the
subforms are based on crosstab queries that provide monthly and quarterly
data totals.

Your assistance is much appreciated.

KC Classic said:
I have a form that changes with a parameter that is entered through a
combo
box. The syntax of the parameter follows:

Forms!frmWhatState![cboStateCode]

This parameter is entered in underlying crosstab queries that supply my
main
form named frmStateCriteria. In an effort to try to broaden the amount
of
information supplied by this form, I have added tab controls and subforms
to
the main form and the form now displays monthly/quarterly totals filtered
by
the State Code. My form displays the correct result set and totals by
state
as requested. The problem occurs when I change the State Code parameter
in
my combo box. I change from say CA (California) to GA (Georgia) and main
form
does not change as requested. The additional tabs that display the
monthly/quarterly information are not updated based upon the new State
Code
criteria. I believe the problem has to do with the linking of my
forms/subforms but the reading I have done to date has further confused
the
issue in my brain. I have tried to Requery using a macro but am not sure
where to run the macro - on the main form or my subform(s).

My goal is to have the monthly/quarterly totals update as the State Code
parameter is changed. Currently, the change will occur but only when the
main form is closed and reopened. I would like to be able to change the
parameter on frmWhatState and have the information follow suit on my main
form.

Anyone have any suggestions?

KC Classic
 

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