473,662 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1856

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.cl one
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.goog legroups.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.goog legroups.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
2001
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 should then have access to those user properties. I am not getting the property value from user that was set in form1. Sorry for posting so much code but I need help bad. How do i make this work? Thanks Mike
5
3788
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 http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
5
1849
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 As New PHfx.Form2 to With Events MyForm2 As New PHfx.Form2 and tried adding an event handler but intellisense will not show form2s objects, just the methods.
1
1904
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 Form1. So far so good.
5
14167
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 variable in form2. Is there a simple method (in VSexpress2005) to get that specific variable in form2? TIA,
3
5930
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. This code works well for splash screen. I searched alot on net for codes but they don't work. for example- (1) Public Sub CloseForm(formType As System.Type) For Each oForm as System.Windows.Forms.Form in me.MdiParent.MdiChildren If...
1
2242
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 "False" only. please see the following code where i did wrong. I ahve created A Visual C# .Net project. for that i ahve added Form2 now my project contains Form1 and Form2. In Form1 i have placed Control "RadioButton1"
9
1632
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 when I am entering a new record in FORM1 and then want to add data to FORM2. when I click cmd button the PK isn't transfered. is there a way I can hit the command key and the PK is automatically transferred to FORM2.
1
1179
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() ListView1.View = lvwReport ListView1.ColumnHeaders.Add , , "NAME" ListView1.ColumnHeaders.Add , , "ID" ListView1.Refresh rs.Open "select * from empdetail", conn, adOpenStatic, adLockOptimistic
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8545
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.