requery

  • Thread starter Thread starter sue gray
  • Start date Start date
S

sue gray

I have subforms that add records. My problem is when I close the subform the
new record does not show until I move to another client and come back to the
original client. I know I have to do a requery of some kind, but I am at a
loss as to where to start. Thanks for any help.
 
Sue,

In the form which you close you should put the following code in the "close"
event:

forms!formname!setfocus
forms!formname!requery

here is where you are telling the form that needs to be requeried to first
get the focus and then requery before closing the form where you are coming
from. You don't have to put anything else in there because you place this in
the close event of the form that made the changes.

Replace the formname with the name of your form...

hth
 
Thank you for your help. That worked great. Another problem I am having
along the same issue is - I have my db set up with page tabs with subforms on
them. My first page is where I collect the demographic info. I use the
record navigator buttons at the bottom of my main form to add new clients.
THe problem is the newclient is not showing up until I close the main form.
ANy help would be greatly appreciatied.
 
No problem,

I assume you mean that the tab has to be requeried after you've inserted a
new client right?

In that case try adding this in the AfterUpdate event of the main form:

me.tabcontrol.pages("name").requery
or
me.tabcontrol.pages(1).requery

where the name tabcontrol should read the name of your tabcontrol
and "name" should read the name you've given your tabpage (the first one).

Remember i'm assuming your tabcontrol is directly on the main form here. If
the tabcontrol is on a subform it should read:

forms!mainformname!subformname!tabcontrol.pages("name").requery

where you change the names accordingly to your situation.

hth
 
Back
Top