Hi bnielsen56
The problem is that "Forms!frm_SIR_maintenance![frm_Approval_Log_subform]" is not a valid member of the Forms collection.
If it were not a subform, then you could get away with passing the form name, because Forms("frmMainForm") is a valid reference to a Form object, but Forms("frmMainForm!frmSubform") is not.
To make your search form truly generic, you should pass a Form object (this could be a main form or a subform).
First, in the declarations section of frm_search_detail, declare a public variable:
Public CallingForm as Form
Now, declare a Form object argument, instead of a form name, for the function that opens the search form:
Function LookupDetailSubform(frm As Form, TxtBoxNm As String, QryName As String)
and have the calling form pass itself:
Call LookupDetailSubform(Me, "cmbo_Approved_By_ID", "qry_employee_lookup")
If the command button is on the main form, then call it like this:
Call LookupDetailSubform(Me!frm_Approval_Log_subform.Form, "cmbo_Approved_By_ID", "qry_employee_lookup")
Now, instead of passing the form name in OpenArgs, set the public variable after opening the form:
DoCmd.OpenForm "frm_search_detail", acNormal
With Forms!frm_search_detail
Set .CallingForm = frm
.txt_filter = ""
.txt_Txt_Box_Name = TxtBoxNm
... etc
End With
Finally, in cmd_OK_Click, set the value of the control on CallingForm:
CallingForm(txt_Txt_Box_Name) = ListString
--
Graham Mandeno (Access MVP)