Repaint vs Refresh vs Requery

R

rob c

I have a form which contains a button that populate a field called "services"
in the subform based on a field called "scope" which is located on the form.
One record of scope on the form usually turns into several records of
"services" on the subform thru the use of an append query. and the "services"
fields do not automatically refresh ("services" is a text box and not a combo
box) The "services" currently has a requery in the "AfterUpdate" because it
is used to populate combox box in a different field on the subquery.

MY QUESTION IS: How can I set the subform to automatically refresh after
the update takes place without affecting the requery that is currently being
used for the combo box?
 
D

Dirk Goldgar

rob c said:
I have a form which contains a button that populate a field called
"services"
in the subform based on a field called "scope" which is located on the
form.
One record of scope on the form usually turns into several records of
"services" on the subform thru the use of an append query. and the
"services"
fields do not automatically refresh ("services" is a text box and not a
combo
box) The "services" currently has a requery in the "AfterUpdate" because
it
is used to populate combox box in a different field on the subquery.

MY QUESTION IS: How can I set the subform to automatically refresh after
the update takes place without affecting the requery that is currently
being
used for the combo box?


I'm not completely sure I understand your setup, and a copy of your current
code would have been helpful, but I think the essential issue is that you
are executing an append query to add records to the table upon which the
subform is based. Naturally, they won't show up on the subform until the
subform is requeried.

So how do you requery the subform? The correct statement requires the name
of the subform -- and not just the name of the form object that the subform
is displaying, but the name of the subform *control*, on the main form, that
acts as a window on that form object. Sometimes the subform control has the
same name as the form it displays, and sometimes it doesn't. You have to
check the Name property of the subform control to be sure.

Suppose your subform control is named "Subform1". Then the statement to
requery it from the main form would be:

Me!Subform1.Requery

It would also be valid to write:

Me!Subform1.Form.Requery

In either case, you would execute this statement right after executing the
append query, probably as the next statement in that procedure.
 

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