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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a record from a subform the current record on a main form.

Status
Not open for further replies.

KenGoonan

Technical User
Dec 14, 2007
17
US
I have a simple search screen that opens with a subform with client records rows based on a query. Users can type in Client ID or Last Name into unbound text boxes and click a search button which run a macro to select/filter out the specific client record row. I want to click or double click on that selected row in the subform and have open the main form and be the current record. Any help would really appreciated. Thanks in advance.
 
I suppose you can do it this way:
1. Create a query that is built with data from whatever table(s) you need, and is filtered(criteria) according to what record is selected in your subform.
2. Then in VBA code, behind the OnClick or DoubleClick - whatever you choose - event in the subform, you change the main form's recordsource to equal that query. Of course, you'll probably need to have the recordsource set to a null string or something else in the Form_Load event, so that it isn't always equalling the subform..

--

"If to err is human, then I must be some kind of human!" -Me
 
I have the same problem and need to populate the mainform record with the subform record. The mainform and subform records all have the same 37 fieldnames, ie; MemberID in mainform is same as MemberID in subform. Father's name is in mainform and Children's names are in subform, like a pedigree database, so when i click a record selector of a child's name in the subform, i would like that record to populate the mainform.
 
I would use a subform or list box for the child records. Use a single view subform for the father's record. You can add a text box on the main form that gets its value from the MemberID on the child subform. On the father subform control set the Link Master to the text box and Link Child to the MemberID.

The control source for the Link Master text box might be something like:
Code:
  =sfrmChildName.Form!MemberID

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top