PC Review


Reply
Thread Tools Rate Thread

Change code to search from"first part of field " to "any part of field"

 
 
mrmajix
Guest
Posts: n/a
 
      15th Nov 2003
I have a form (InventorySearch) with a text box (txtEntry) which requeries
the subform (InventorySearchSubform) on change. The search expression is
linked to the field (Description). How can I change this code to search "any
part of the field" instead of the "first part of field". Thanks in advance.

Private Sub txtEntry_Change()
Me!txtSearchExpression = Me!txtEntry.Text & "*"
InventorySearchDetail.Requery

Exit_txtEntry_Change:
Exit Sub

Err_txtEntry_Change:
MsgBox Err.Description
Resume Exit_txtEntry_Change
End Sub


 
Reply With Quote
 
 
 
 
Wayne Morgan
Guest
Posts: n/a
 
      15th Nov 2003
It appears you are using the Like statement in the parameter of the query to filter the
list. Placing a * in the front also should do what you want.

"*" & Me!txtEntry.Text & "*"

--
Wayne Morgan
Microsoft Access MVP


"mrmajix" <(E-Mail Removed)> wrote in message
news:C4rtb.10934$(E-Mail Removed)...
> I have a form (InventorySearch) with a text box (txtEntry) which requeries
> the subform (InventorySearchSubform) on change. The search expression is
> linked to the field (Description). How can I change this code to search "any
> part of the field" instead of the "first part of field". Thanks in advance.
>
> Private Sub txtEntry_Change()
> Me!txtSearchExpression = Me!txtEntry.Text & "*"
> InventorySearchDetail.Requery
>
> Exit_txtEntry_Change:
> Exit Sub
>
> Err_txtEntry_Change:
> MsgBox Err.Description
> Resume Exit_txtEntry_Change
> End Sub
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search/Match/Find ANY part of string to ANY part of Cell Value TWhizTom Microsoft Excel Worksheet Functions 0 21st Jul 2008 08:16 PM
Ignoring Text in Search Field OR Give Priority to a Search Field bfiser@gmail.com Microsoft Frontpage 1 24th Jan 2007 10:46 AM
how do I search for a contact using part of first name and part o. =?Utf-8?B?UmF2aSBNdXJ0aHk=?= Microsoft Outlook Contacts 1 19th Jan 2005 11:40 PM
Code to search 'any part of field' AMH Microsoft Access Queries 3 11th Jul 2004 02:55 PM
Re: Excel XP VBA code to search all macro code in Excel module for specific search string criteria Frank Kabel Microsoft Excel Programming 0 19th May 2004 08:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:14 AM.