473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Repost: find record in form1 from form2


I am reposting this message. I am a beginner using MS Access. I am
working in MS Access 2000 and have created two forms. Form 1 is called
frmParent (which has a read only 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 refreshes the subform
but 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. It takes me to the first record by ascending order
in the list box. If Mr. smith ID is 2 and Mr. Jackson ID is 1, after
adding the children for Mr. smith and closing the pop up form the
record for Mr. Jackson is shown in frmParent. I want to see Mr. Smith's

record along with added children in the subform.
I understand I can directly add the recods in the subform and save all
the hastle but this is how the client wants to see the records added to

subform.
I will appreciate any help.

Thanks
Reply »

Jun 19 '06 #1
4 1838

Kaur wrote:
I am reposting this message. I am a beginner using MS Access. I am
working in MS Access 2000 and have created two forms. Form 1 is called
frmParent (which has a read only 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 refreshes the subform
but 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. It takes me to the first record by ascending order
in the list box. If Mr. smith ID is 2 and Mr. Jackson ID is 1, after
adding the children for Mr. smith and closing the pop up form the
record for Mr. Jackson is shown in frmParent. I want to see Mr. Smith's

record along with added children in the subform.
I understand I can directly add the recods in the subform and save all
the hastle but this is how the client wants to see the records added to

subform.
I will appreciate any help.

Thanks
Reply »


Do you have a requery on the pop-up. This is what is bring you back to
the first record after the pop-up is closed.

Jun 19 '06 #2

Cilla wrote:
Kaur wrote:
I am reposting this message. I am a beginner using MS Access. I am
working in MS Access 2000 and have created two forms. Form 1 is called
frmParent (which has a read only 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 refreshes the subform
but 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. It takes me to the first record by ascending order
in the list box. If Mr. smith ID is 2 and Mr. Jackson ID is 1, after
adding the children for Mr. smith and closing the pop up form the
record for Mr. Jackson is shown in frmParent. I want to see Mr. Smith's

record along with added children in the subform.
I understand I can directly add the recods in the subform and save all
the hastle but this is how the client wants to see the records added to

subform.
I will appreciate any help.

Thanks
Reply »


Do you have a requery on the pop-up. This is what is bring you back to
the first record after the pop-up is closed.


If you need the requery on the pop-up heres one way around it:

dim a varable such as xxx as an integer and make xxx = the main forms
key field at the top of the vb to open the pop-up as shown below:

Dim xxx as integer
Xxx = me![KeyField]

At the end of the vb for the pop-up do a record set search back to the
orginial number you opened the pop-up from.

Dim rs as object
Set rs = me.recordset.clone
Rs.FindFirst "[Keyfield] = " & xxx
If Not rs.EOF then me.bookmark = rs.bookmark

Jun 19 '06 #3
"Kaur" <ka***@saic.com> wrote in
news:11**********************@f6g2000cwb.googlegro ups.com:

I am reposting this message. I am a beginner using MS Access.
I am working in MS Access 2000 and have created two forms.
Form 1 is called frmParent (which has a read only 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 refreshes the subform but does not take me to the selected
parent for whom I added the children.
It seems to me from your design that you have not properly bound
the main form to the parents table, because the flow should be
as follows:

step action
1 Select parent from listbox.
2 Move frmParents to parent selected in step 1
3 Click add children button to open Popup.
4 Add children for parent on frmParent.
5 Close Popup, requery subform only
6 You are back at frmParents, which is still showing parent
selected in step 1

I cannot figure exactly what your actual flow is, but you are
doing something that makes the frmParent lose its reference
point.

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.
There should be no need to take you to mr Smith's record. You
should already be on Mr Smith's record, in order to add his
children.

It takes me to the first record by ascending order in the list box. If Mr. smith ID is 2 and Mr. Jackson ID is 1,
after adding the children for Mr. smith and closing the pop up
form the record for Mr. Jackson is shown in frmParent. I want
to see Mr. Smith's

record along with added children in the subform.
I understand I can directly add the recods in the subform and
save all the hastle but this is how the client wants to see
the records added to

subform.
I will appreciate any help.

Thanks
Reply »


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jun 19 '06 #4
Thanks ever so much.
I found out my mistake. I was requering the main form as well as sub
form. Removing requering the main form settled the problem

Once again thanks.
Bob Quintal wrote:
"Kaur" <ka***@saic.com> wrote in
news:11**********************@f6g2000cwb.googlegro ups.com:

I am reposting this message. I am a beginner using MS Access.
I am working in MS Access 2000 and have created two forms.
Form 1 is called frmParent (which has a read only 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 refreshes the subform but does not take me to the selected
parent for whom I added the children.


It seems to me from your design that you have not properly bound
the main form to the parents table, because the flow should be
as follows:

step action
1 Select parent from listbox.
2 Move frmParents to parent selected in step 1
3 Click add children button to open Popup.
4 Add children for parent on frmParent.
5 Close Popup, requery subform only
6 You are back at frmParents, which is still showing parent
selected in step 1

I cannot figure exactly what your actual flow is, but you are
doing something that makes the frmParent lose its reference
point.

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.


There should be no need to take you to mr Smith's record. You
should already be on Mr Smith's record, in order to add his
children.

It takes me to the first record by ascending order in
the list box. If Mr. smith ID is 2 and Mr. Jackson ID is 1,
after adding the children for Mr. smith and closing the pop up
form the record for Mr. Jackson is shown in frmParent. I want
to see Mr. Smith's

record along with added children in the subform.
I understand I can directly add the recods in the subform and
save all the hastle but this is how the client wants to see
the records added to

subform.
I will appreciate any help.

Thanks
Reply »


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com


Jun 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mike | last post by:
Please help this is driving me nuts. I have 2 forms, 1 user class and I am trying to implement a singleton class. Form 1 should create a user object and populate some properties in user. Form2...
5
by: nadir b | last post by:
hi I don't know how to change for exemple a form1 caption text from form2 don't forget that form2 has created from form1 I want sample code with c# *** Sent via Developersdex...
5
by: PAPutzback | last post by:
Form2 has one purpose to open and list some names and ids. I want to handle the list box click event on form2 so I can get the selected value onto a field in form1. I changed this Dim MyForm2...
1
by: Richard | last post by:
Hello there, I have a form that is called from a Sub Main procedure using application.run(Form1). On my main form there is a button to open an instance of Form2 and then at the same time hide...
5
by: John | last post by:
Hi, I can't find a simple example for a simple(?) problem. I am working on an application with a variable in form1, that variable is needed in form2 for a calculation but i can't get that...
3
by: Karan | last post by:
I am calling finalize when form2 loads and deactivates form1 which closes form1. However, same thing is not happening in form2 because finalize is already called. Does anybody has solution to it....
1
by: Suma | last post by:
Hi, i have a problem with the controls .i have to validate Form1 Radio button option is checked or Not in the Form2. even after checking the radio button also in FOrm2 it is always taking as...
9
by: liverbarry | last post by:
Please help!!! I have two forms, FORM1 has PK. FORM2 has foriegn key FK. I have a command button in FORM1 that will open FORM2 and display linked data if it is already stored. My problem is...
1
by: Vbbeginner07 | last post by:
The follwing code is of a listview where i have to a to display the id and the name from a particular table ,empdetail. This is in the second form,dispalying id and name Private Sub Form_Load()...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.