Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FINDING RECORDS IN A SUBFORM

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have created a form to imput member information using two tables, Membership and Mailing list. Because there can be more than one member per address, I have used a subform for the Membership (names) and the main form for the Mailing list (addresses). I would like to create a Find Record button on the subform to locate specific members by name, as I don't always know their address, but I cannot see the button in form view only in design view. Can I create a find record button on a subform and if so how?
 
You can but you'll need to change the subform from Datasheet to either Form or Continuous Form view. You can design the Continuous Form view to look almost exactly like the Datasheet view yet still have a Form Header and/or Footer where you can put your find record control. Make sure when you use the find record code within the subform that it includes the main form name.
 
Thank you for your help on June 28. Your suggestion worked however I now have a new problem. The find record button will only locate records that are one to many with the record on the main form. In other words If I want to find a different family name it will not find it. It will only locate names that are associated with the address showing in the main form. I'm not sure I am making myself clear. What I want to happen is to find any last name in the subform and the corresponding address in the main form. Ie. Showing on the subform are the members of the English family. On the main form is their address etc. When I try to use the button on the subform to Find a different family name ie. French it tells me that it cannot be found. I know its there. How do I get it to search through all the records of the subform and not just the record that is attached to the main form information that is showing when I do the search. (I can move from record to record in the the main form.)

I hope I have made this so complicated that you can't understand what I want but I'm haveing problems here with my description. Please help if you can. Thanks
 
Your problem lies, I think, with a misunderstanding of what a subform is and does. A subform is a subdataset of related records to the mainform's record. The mainform is a parent to any records in the subform. Just as a parentmay have many children and child only has one(father or mother). Therefore, for any record on the main form there are only related records in the subform. What you appear to be trying to do is have the subform act as the parent whereby you'd select a record in the subform and expect the main form's record to change. As a rule, this is not the way the relationships are designed to work. Try using linked forms instead of a subform. In this way, you can have all of the records you wish in the names form and then only the corresponding address in the address form. The names form can be a datasheet or continuous form and the address a single form. Link the two by using the OnCurrent event of the names form to set the filter property of the address form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top