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!

call up information in subform

Status
Not open for further replies.

quinbe

Programmer
Dec 30, 2004
62
US
Good morning all,
I created a form with a subform. This is what I'm trying to do. There is a text box named Header, if I type in to call a specific header, the detail information would appear in the subform.
Please guide me how to do this
Thanks

 
I assume 'Header' is a textbox on the main form, thus do the following:

Create an 'AfterUpdate' event:
Private Sub Header_AfterUpdate()
Me.subformname.Requery
End Sub

Either set your subform recordsource to select records based on the 'Header' field, or use the 'Link Child' and 'Link Master' settings for the subform and link on field 'Header'.


Code: Where the vision is often rudely introduced to reality!
 
Hi Trevil,
I tried the code above but I'm not sure what I did wrong
Compile error:
Method or data member not found

[highlight] Private Sub Header_AfterUpdate()[/highlight]
Me[highlight blue].Table2[/highlight] SubForm.Requery
End Sub

I'm not sure about 'Link Child', 'Link Master' that you mention above. Thanks for your help
 
And this ?
Me![Table2 SubForm].Requery

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I tried your code. The error disaapeared, it don't take any action otherwise
Please help. Thanks again
 
Is your subform linked via the 'Link Child / Link Master' properties?

What is the recordsource for the subform?

Code: Where the vision is often rudely introduced to reality!
 
Thanks Trevil for your response!
I checked my subform properties. There are both Link Child and Link Master with field = Header_ID
The recordsource for the subform is in datasheet view.
Do I have set the properties correctly?
 
When you say 'The recordsource for the subform is in datasheet view', I believe the recordsource property for the subform is either a table name or a query name or a SQL string. Which is it? If a query or SQL, please show the SQL.

Code: Where the vision is often rudely introduced to reality!
 
I'm having the same issue as the person above. I have a main form and a subform. On the main form (frmHDA) I have a combo box to select the HDA. The in the sub form (sfrmHDAInformation) I have a query to pull the selected data, but it is pulling down any information. My parent/child is linked at the field "HDAs." The information for the combo box and the subform are coming from the same table. Could that be the issue? Below is the SQL I have on the subform:

SELECT [HDA Contact Information].HDAs, [HDA Contact Information].Division, [HDA Contact Information].NewDivision, [HDA Contact Information].City, [HDA Contact Information].Company, [HDA Contact Information].Zip, [HDA Contact Information].Street, [HDA Contact Information].ActualCity, [HDA Contact Information].State
FROM [HDA Contact Information]
WHERE ((([HDA Contact Information].HDAs)=[forms]![frmHDA]![SelectParent]));

Thanks,
Sharon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top