0
votes

I have a main form1 (formview) and a subform2 (datasheetview) based on the same query like a splitform.

In the main form1 i have a textbox that i want to use like a searchbox for the subform2.

This searchbox has to filter the subform2 datasheet by searching in 3 different fields (name, type, number) and when finding a record that matches the searchbox's value, it has to filter the datasheet by this value.

I tried with macro Applyfilter and VBA but didn't succed.. Can someone help me?

1
i need a searchbox feature, i know how to do a pseudo-splitform and i used that way you linked.. but now i need a searchbox..Alex
Should edit question to show attempted code.June7

1 Answers

1
votes

Consider:

Private Sub tbxSearch_AfterUpdate()
Me.ctrDS.Form.Filter = "Member_name LIKE '*" & Me.tbxSearch & "*' OR TypeOfBusiness LIKE '*" & Me.tbxSearch & "*' OR Member_ContactNumber='" & Me.tbxSearch & "'"
Me.FilterOn = True
End Sub

Or

Private Sub tbxSearch_AfterUpdate()
With Me.ctrDS.Form.RecordsetClone
    .FindFirst "Member_name LIKE '*" & Me.tbxSearch & "*' OR TypeOfBusiness LIKE '*" & Me.tbxSearch & "*' OR Member_ContactNumber='" & Me.tbxSearch & "'"
    If Not .NoMatch Then Me.ctrDS.Form.Bookmark = .Bookmark
End With
End Sub