Applying Wildcard for search

  • Thread starter Thread starter Participant
  • Start date Start date
P

Participant

Hi there,
i am creating a form where I have a search field. I want to be able to
search by the entire name or part of it. I have used a query that has LIKE
statement with % but it did not work for soem reason

This is the code I used
Like "Forms!MyFormName!MyTextBox%"

Any ideas?

Regards
 
Try

Like Forms!MyFormName!MyTextBox & "%"

You may need to use the asterisk as the wildcard character if you are using an
..mdb or .accdb as the database storing the data. Access (with Jet - the
native database engine) uses different wildcard characters than ANSI compliant
SQL.
Like Forms!MyFormName!MyTextBox & "*"

Also if you want to do a contains search - string is in any part of the field
Like Forms "%" & !MyFormName!MyTextBox & "%"


John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 
Back
Top