Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: requery

Geek News

requery
sue gray 12/11/2008 5:05:01 PM
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.
RE: requery
Maurice 12/12/2008 1:01:01 PM
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
--
Maurice Ausum


"sue gray" wrote:

[Quoted Text]
> 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.
RE: requery
sue gray 12/12/2008 2:43:02 PM
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.

"Maurice" wrote:

[Quoted Text]
> 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
> --
> Maurice Ausum
>
>
> "sue gray" wrote:
>
> > 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.
RE: requery
Maurice 12/12/2008 6:14:12 PM
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
--
Maurice Ausum


"sue gray" wrote:

[Quoted Text]
> 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.
>
> "Maurice" wrote:
>
> > 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
> > --
> > Maurice Ausum
> >
> >
> > "sue gray" wrote:
> >
> > > 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.

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net