Refresh Form - Help?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an interesting problem (maybe its not so interesting to the gurus who
frequent this board :) ). Here is the back ground information:

I have a form that contains tab controls and several sub forms. The main
form contains a control that dictates what data is displayed on one of my sub
forms via parameters in the query (data source).

So, I have added some code to the "after update" event that looks like this:

---------------------
me.form.refresh
me.form.requery
---------------------

I have also tried:

---------------------
Me.[sub_form_control_name].Requery
---------------------

The result: sub form just comes up blank. If I view the form in design view
and then in normal view again, then the correct data shows up. For some
reason, the sub form is not reloading.

Can you help?
 
Hey, not sure if Im right... but where is your AfterUpdate coming from?

A combobox, textbox? If so most likely you have to right something like

Me.Requery "sub_form_control_name"

I think your current code is not activating the requery event.
lmk
 
The correct way to refresh a control on a subform from the parent form is:

Me!NameOfSubformControl.Form!NameOfControlOnSubform.Requery

Note that depending on how you added the form as a subform, the name of the
subform control on the parent form may not be the same as the name of the
form being used as a subform.

You might be interested in http://www.mvps.org/access/forms/frm0031.htm at
"The Access Web"
 
I tried this and when I run it I get a compile error ("Invalid arguments")
Here is the exact code I used:

Me.Requery "sub_media1"
 
Douglas-

I am not trying to refresh a control on a subform. I am trying to refresh
the data or query set for the subform.

Any other ideas?
 
In that case, you want

Me!NameOfSubformControl.Form.Requery

Did you check the reference I gave you?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


dmericksen said:
Douglas-

I am not trying to refresh a control on a subform. I am trying to refresh
the data or query set for the subform.

Any other ideas?
 
Yes, I did see your reference (and yes, it is very helpful!). However, I am
still having problems. I used the exact syntax you put forward
(Me!NameOfSubformControl.Form.Requery) and I get errors. I will post the
errors in another post.

Douglas J. Steele said:
In that case, you want

Me!NameOfSubformControl.Form.Requery

Did you check the reference I gave you?
 
I may be wrong, but I think you need to refresh your subform
"Me.subformnname.refresh" Also, once you enter data into the subform, it may
be going on to the naext record which may or may not be blank.

AKphidelt said:
Hey, not sure if Im right... but where is your AfterUpdate coming from?

A combobox, textbox? If so most likely you have to right something like

Me.Requery "sub_form_control_name"

I think your current code is not activating the requery event.
lmk

dmericksen said:
I have an interesting problem (maybe its not so interesting to the gurus who
frequent this board :) ). Here is the back ground information:

I have a form that contains tab controls and several sub forms. The main
form contains a control that dictates what data is displayed on one of my sub
forms via parameters in the query (data source).

So, I have added some code to the "after update" event that looks like this:

---------------------
me.form.refresh
me.form.requery
---------------------

I have also tried:

---------------------
Me.[sub_form_control_name].Requery
---------------------

The result: sub form just comes up blank. If I view the form in design view
and then in normal view again, then the correct data shows up. For some
reason, the sub form is not reloading.

Can you help?
 
Back
Top