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

Pass value from main form to subform for filtering

Status
Not open for further replies.

JKDeveloper0718

Programmer
Aug 11, 2006
23
US
My problem is that I have a form frmApplication and it has a text box called Text680 that has the given value I need. then I have a tab control called tabApplication with a subform called sfrmFamilyMembers. According to an event load I would like to call a dao recordset with the filter coming from the Text680 value in the main form any suggestion on the vba variable call.
I have tried forms!frmApplication!Text680 and tried to set it to a variable or even debug.print but it doesnt like it.
 
Do you wish to set child and master fields, reference the text box in a query, build a query string from scratch or simply set the filter for a form?
 
no it is a Dao recordset from a table by the value from the textbox but has nothing to do with filtering the subform its just an event happening in the background of the subform
 
I am still a little in the dark. I guess you are having problems referring to the textbox from the subform? Have you tried:

Code:
'For numeric, skip the single quotes, for dates use #
strSQL="Select * From tblTable Where SomeTextField='" & Me.Parent.Text680 & "'"
Set rs = CurrentDB.Openrecordset(strSQL)
 
Actually its the Text680 from the Main Form the subform that calls this is on top of the mainform in a tab. So everything in on the same form just subform on top inside a tab control. So Text680 is not in the subform.
 
I think you will find that the snippet I posted refers to a textbox on a main form from code on a subform. If this is not what you mean, please post your existing code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top