Hi. I actually created a Form that has txtBox, CommandButton and a subform below.. My search is working and I would like to add on my search code like..
Example : on my database i had this name "John Patrick" and "Patrick John" on my current code.. when i put "John" on the textbox and press CommandButton(search) it will show me "John Patrick" and not "Patrick John". I want to ask if what would I do so it can also show "Patrick John" when I just put "John" on the txtbox?
BTW here's my code..
--------------------------------------------------------------------------------------------
LEGEND :
Command33 -- Button that i consider as Search Button
GOLDNEWCONNECT_ValidateSubform -- a form where my database/table will show
GOLDNEWCONNECT -- Database/Table
Text34 -- Textbox where i will put the value/data that i want to search
Emboss_Name -- the name of the column where the data that i would like to search is stored.
---------------------------------------------------------------------------------------------
Code:Private Sub Command33_Click() 'Update the record source Me.GOLDNEWCONNECT_ValidateSubform.Form.RecordSource = "SELECT * FROM GOLDNEWCONNECT " & BuildFilter ' Requery the subform Me.GOLDNEWCONNECT_ValidateSubform.Requery End SubThank you in Advanced (^.~)olllCode:Private Function BuildFilter() As Variant Dim varWhere As Variant Dim varColor As Variant Dim varItem As Variant Dim intIndex As Integer varWhere = Null ' Main filter If Me.Text34 > "" Then varWhere = varWhere & "[Emboss_Name] LIKE """ & Me.Text34 & "*"" AND " End If ' Check if there is a filter to return... If IsNull(varWhere) Then varWhere = "" Else varWhere = "WHERE " & varWhere ' strip off last "AND" in the filter If Right(varWhere, 5) = " AND " Then varWhere = Left(varWhere, Len(varWhere) - 5) End If End If BuildFilter = varWhere End Function