Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 6th, 2005, 10:33 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populate Main/Sub Form

Hi All

Is there any way that when a text box is populated in a main form that it will populate a text box in a sub form with the same detail.I want the user to select a name in the main form and this will link in the ************ Male Female in the main form.But I want this also to appear in the sub form.

Thanks


Brendan Bartley
__________________
Brendan Bartley
  #2 (permalink)  
Old December 6th, 2005, 10:49 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

If your form is bound to the same source as your subform, just do a requery on your subform and it should populate itself. Let me know if they are not bound to the same source and I could probably come up with something different.

HTH

Mike

Mike
EchoVue.com
  #3 (permalink)  
Old December 6th, 2005, 11:10 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No Mike the forms are not bound
Thanks
Brendan

Brendan Bartley
  #4 (permalink)  
Old December 6th, 2005, 11:15 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Alrighty Then...

Typically a subform is setup in a many to one relationship with the main form. It almost sound like in your case, you have a one to one relationship. If this is the case, your could try adding an On_Change event to the control on the main form, and then using that to change the control on the sub form.

Code:
Me.frmSubForm.txtSex = Me.txtSex
I would think that should work.

Mike

Mike
EchoVue.com
  #5 (permalink)  
Old December 6th, 2005, 11:27 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mike
sorry the forms are bound in a one to many relationship Mike how do I requery the sub Form
Thanks

Brendan Bartley
  #6 (permalink)  
Old December 6th, 2005, 11:31 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Hi Brendan,

To requery the subFrom, just use Me.frmSubFormName.Requery

The problem with the one to many relationship, is that I don't know of a way that you can specify which record in the subform you would like to be changed. However hopefully the requery works for you.

Mike

Mike
EchoVue.com
  #7 (permalink)  
Old December 6th, 2005, 11:58 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mike
Sorry the code is not working I am getting the same message

Method or data not found

Thanks

Brendan Bartley
  #8 (permalink)  
Old December 6th, 2005, 12:05 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Huh!?

Sometimes Access assigns different names to controls. Check using the properties, what the name is for the Sub Form, and the various controls, and then ensure that you have the correct spelling - This one always gets me.

Mike

Mike
EchoVue.com
  #9 (permalink)  
Old December 9th, 2005, 06:30 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mike
Tweaked the code everything ok now
Thanks

Brendan Bartley


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sizing Main/Sub Form Brendan Bartley Access 2 September 11th, 2006 07:50 AM
C++ Builder 6 - Contolling the Main Form rowin C++ Programming 0 January 30th, 2006 08:30 AM
updating main form from subform dartcoach Access 6 April 28th, 2005 08:27 AM
how to parse filter from a form to a main form flyfish Access 1 February 1st, 2005 05:36 AM
Passing Value from main form to Popup Form smartgir Access VBA 0 February 26th, 2004 06:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.