Connecting Tech Pros Worldwide Forums | Help | Site Map

Show newly added record

Kaur
Guest
 
Posts: n/a
#1: Jun 16 '06
Hi,

I am working in MS Access 2000 and have created two forms. Form 1 is
called frmParent (which has a subform called SfrmChild). FrmParent has
a list box that lists all the Last Names of parents in the db. Clicking
on one of the lastname of parent in the list box shows children of
selected parent in the SfrmChild. I have a button on frmParent that
opens up a pop up form where user can add children to the selected
parent. My problem is when I close the pop up form, It does not take me
to the selected parent for whom I added the children. For example if I
added children for Mr.Smith, the children gets added to subform but
closing the pop up form does not take me to Mr. Smith's record. How can
I automate that each time I add children for a selected parent, closing
the pop form will take me to the selected parent's record for whom I
added the children.

I will appreciate any help.

Thanks


ComputerJunkie
Guest
 
Posts: n/a
#2: Jun 16 '06

re: Show newly added record



Kaur wrote:
[color=blue]
> Hi,
>
> I am working in MS Access 2000 and have created two forms. Form 1 is
> called frmParent (which has a subform called SfrmChild). FrmParent has
> a list box that lists all the Last Names of parents in the db. Clicking
> on one of the lastname of parent in the list box shows children of
> selected parent in the SfrmChild. I have a button on frmParent that
> opens up a pop up form where user can add children to the selected
> parent. My problem is when I close the pop up form, It does not take me
> to the selected parent for whom I added the children. For example if I
> added children for Mr.Smith, the children gets added to subform but
> closing the pop up form does not take me to Mr. Smith's record. How can
> I automate that each time I add children for a selected parent, closing
> the pop form will take me to the selected parent's record for whom I
> added the children.
>
> I will appreciate any help.
>
> Thanks[/color]

Kaur, when you move back to the frmParent, hit the F9 key - this
carries out a page refresh.
If you want to do this automatically, you can set up an auto refresh
(known as a requery) in the AfterUpdate method of the frmParent and the
OnClose method of the SfrmChild. The command would look something like
this:

sub SfrmChild Close()
docmd.openform "frmParent"
docmd.close acDefault
end sub

sub frmParent AfterUpdate()
docmd.requery
end Sub

Hope this helps.
D

Kaur
Guest
 
Posts: n/a
#3: Jun 19 '06

re: Show newly added record


Thanks for the reply,
My problem is the subform does get updated but it does not show me the
record for which I added the children. e.g. If I added the children for
Mr. Smith, on closing the pop up form it shows me the record that comes
first in ascending order of the parent listbox.
I want the popup form close action to take me back to Mr. Smith's
record.

Manjeet

ComputerJunkie wrote:[color=blue]
> Kaur wrote:
>[color=green]
> > Hi,
> >
> > I am working in MS Access 2000 and have created two forms. Form 1 is
> > called frmParent (which has a subform called SfrmChild). FrmParent has
> > a list box that lists all the Last Names of parents in the db. Clicking
> > on one of the lastname of parent in the list box shows children of
> > selected parent in the SfrmChild. I have a button on frmParent that
> > opens up a pop up form where user can add children to the selected
> > parent. My problem is when I close the pop up form, It does not take me
> > to the selected parent for whom I added the children. For example if I
> > added children for Mr.Smith, the children gets added to subform but
> > closing the pop up form does not take me to Mr. Smith's record. How can
> > I automate that each time I add children for a selected parent, closing
> > the pop form will take me to the selected parent's record for whom I
> > added the children.
> >
> > I will appreciate any help.
> >
> > Thanks[/color]
>
> Kaur, when you move back to the frmParent, hit the F9 key - this
> carries out a page refresh.
> If you want to do this automatically, you can set up an auto refresh
> (known as a requery) in the AfterUpdate method of the frmParent and the
> OnClose method of the SfrmChild. The command would look something like
> this:
>
> sub SfrmChild Close()
> docmd.openform "frmParent"
> docmd.close acDefault
> end sub
>
> sub frmParent AfterUpdate()
> docmd.requery
> end Sub
>
> Hope this helps.
> D[/color]

Closed Thread