Show newly added record

K

Kaur

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
 
J

jahoobob via AccessMonster.com

Is the popup form adding the children to the correct parent in you table. If
it is then I would suspect that there is a requery or refresh going on when
the popup is closed.
Simplify by adding the data in the subform. When you have a parent in the
Parent form the children in the subform will be added to that parent and
you'll still be in that parent's record when all is done.
 
K

Kaur

Thanks for the reply.
The pop up form is adding the children in the correct parent. Each time
I finish adding child to a parent and close the pop up form, it takes
me to the record that comes first as an ascending order in the parent
list box. e.g. if parentID for Mr. smith is 2 and ParentID Mr.Jackson
is 1, I am taken to Mr. Jackson's record although I added the children
for Mr. Smith. When I click on Mr. smith again in the list box, I see
the added children for Mr. Smith in the subform. I should be able to
view the records of parent for whom I added the children after closing
the pop up form.

Thanks
 
A

aaron.kempf

with Access Data Projects you can use @@IDENTITY in order to get the
new identity number

it's beautiful functionality that ins't practical on the mdb side of
the equation
 
A

aaron.kempf

1) start MS access
2) file, new
3) choose 'project' instead of application
4) point to a sql server or msde server
5) if you dont have msde download it at www.microsoft.com/sql
6) write a stored procedure
'insert into myTable (TheValue, DateEntered)
Values (12, '1/12/2006')


and then on the 2nd line of that stored procedure; you have

Select @@identity

this will do what you're trying to do without any coding on the
application front end.

I highly reccomend a basic book on SQL Server; or something along those
lines.. it is a bit to chew off-- but it is worth it in the long run.
 

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