If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Filter multiple fields with one search criteria on form
I have a form with 2 fields - Name1 and Name2. I want to be able to enter
search criteria in my unbound text box and have it check both fields and return records if the text is in either Name1 OR Name2. Currently, I have it working for just one field. If Not IsNull(Me.txtfiltername) Then strWhere = strWhere & "([Name1] Like ""*" & Me.txtfiltername & "*"") AND " End If How do I get it to search on Name2 as well? Thanks in advance. |
#2
|
|||
|
|||
Filter multiple fields with one search criteria on form
If Not IsNull(Me.txtfiltername) Then
strWhere = strWhere & "([Name1] Like ""*" & Me.txtfiltername & "*"" Or [Name2] Like ""*" & Me.txtfiltername & "*"") AND " End If "hlock" wrote: I have a form with 2 fields - Name1 and Name2. I want to be able to enter search criteria in my unbound text box and have it check both fields and return records if the text is in either Name1 OR Name2. Currently, I have it working for just one field. If Not IsNull(Me.txtfiltername) Then strWhere = strWhere & "([Name1] Like ""*" & Me.txtfiltername & "*"") AND " End If How do I get it to search on Name2 as well? Thanks in advance. |
#3
|
|||
|
|||
Filter multiple fields with one search criteria on form
The quotes don't look quite right.
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Kipp Woodard" wrote in message ... If Not IsNull(Me.txtfiltername) Then strWhere = strWhere & "([Name1] Like ""*" & Me.txtfiltername & "*"" Or [Name2] Like ""*" & Me.txtfiltername & "*"") AND " End If "hlock" wrote: I have a form with 2 fields - Name1 and Name2. I want to be able to enter search criteria in my unbound text box and have it check both fields and return records if the text is in either Name1 OR Name2. Currently, I have it working for just one field. If Not IsNull(Me.txtfiltername) Then strWhere = strWhere & "([Name1] Like ""*" & Me.txtfiltername & "*"") AND " End If How do I get it to search on Name2 as well? Thanks in advance. |
#4
|
|||
|
|||
Filter multiple fields with one search criteria on form
Works perfect. Thank you for all of your help!!
"Douglas J. Steele" wrote: The quotes don't look quite right. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Kipp Woodard" wrote in message ... If Not IsNull(Me.txtfiltername) Then strWhere = strWhere & "([Name1] Like ""*" & Me.txtfiltername & "*"" Or [Name2] Like ""*" & Me.txtfiltername & "*"") AND " End If "hlock" wrote: I have a form with 2 fields - Name1 and Name2. I want to be able to enter search criteria in my unbound text box and have it check both fields and return records if the text is in either Name1 OR Name2. Currently, I have it working for just one field. If Not IsNull(Me.txtfiltername) Then strWhere = strWhere & "([Name1] Like ""*" & Me.txtfiltername & "*"") AND " End If How do I get it to search on Name2 as well? Thanks in advance. |
Thread Tools | |
Display Modes | |
|
|