Hello all, needing some help on this please.
I made a form based on a products table query. Made a searchbox and button, works great.
code for the search function is as follows.
Private Sub Search_btn_Click()
DoCmd.ApplyFilter "", "[PartNumber1] Like ""*"" & Forms![OrderForm_F]![Small_Part_Search_F].Form![SearchBox] & ""*"" Or [PartNumber2] Like ""*"" & Forms![OrderForm_F]![Small_Part_Search_F].Form![SearchBox] & ""*"" "
End Sub
This works fine on its own.
If I add this form to another form, so this form becomes the subform, it all falls apart from here.
I have tried to use a button and textbox on the main form, no luck. Also tried this piece of code, but all it does is replace the Value in the table rather than filtering it.
Public Sub Search_btn2_Click()
Dim strSQL As String
strSQL = "Select * from Supplier_Products_Q where"
strSQL = strSQL & Forms![OrderForm_F].Form![Small_Part_Search_F]![PartNumber] = " & Me!Search_txt2"
Forms![OrderForm_F].Form![Small_Part_Search_F]![PartNumber] = strSQL
Me.RecordSource = strSQL
I've been struggling with this for weeks, driving me nuts. I had a look at access.mvps.org/access/forms/frm0023.htm to get this code.
So to sum up..
I have a mainform with a subform. Subform has an apply filter command on a button click.
There is no data link between Mainform and Subform.
What i'm trying to do is be able to search for a product and use the "ID" to manually add to an order on another subform on same page.
I read that you cant use the 'ApplyFilter' command on a subform.
Can Anyone Please help?
I hope you understand what I mean.:banghead:
Thanks
Nick
I made a form based on a products table query. Made a searchbox and button, works great.
code for the search function is as follows.
Private Sub Search_btn_Click()
DoCmd.ApplyFilter "", "[PartNumber1] Like ""*"" & Forms![OrderForm_F]![Small_Part_Search_F].Form![SearchBox] & ""*"" Or [PartNumber2] Like ""*"" & Forms![OrderForm_F]![Small_Part_Search_F].Form![SearchBox] & ""*"" "
End Sub
This works fine on its own.
If I add this form to another form, so this form becomes the subform, it all falls apart from here.
I have tried to use a button and textbox on the main form, no luck. Also tried this piece of code, but all it does is replace the Value in the table rather than filtering it.
Public Sub Search_btn2_Click()
Dim strSQL As String
strSQL = "Select * from Supplier_Products_Q where"
strSQL = strSQL & Forms![OrderForm_F].Form![Small_Part_Search_F]![PartNumber] = " & Me!Search_txt2"
Forms![OrderForm_F].Form![Small_Part_Search_F]![PartNumber] = strSQL
Me.RecordSource = strSQL
I've been struggling with this for weeks, driving me nuts. I had a look at access.mvps.org/access/forms/frm0023.htm to get this code.
So to sum up..
I have a mainform with a subform. Subform has an apply filter command on a button click.
There is no data link between Mainform and Subform.
What i'm trying to do is be able to search for a product and use the "ID" to manually add to an order on another subform on same page.
I read that you cant use the 'ApplyFilter' command on a subform.
Can Anyone Please help?
I hope you understand what I mean.:banghead:
Thanks
Nick
Last edited: