Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / March 2006

Tip: Looking for answers? Try searching our database.

Criteria = Like "*this*" With Prompted Entry

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tecknomage - 28 Mar 2006 18:41 GMT
Sorry if this is answered elsewhere, but I couldn't figure out a search
phrase that gave me an answer.

The database has a field containing strings.

I want to create a query using>  LIKE "*this*"  <where "this" is a prompted
input from a user to do a sub-string search.  Example, search the
string-field for the sub-string "bow".

Running the query would prompt the user to [Enter search string] and "this"
would become what they want to query.

I cannot figure out how to get the prompt to work.

(Comment:  Lotus is much easier to use, especially something like this)
Michel Walsh - 28 Mar 2006 18:49 GMT
Hi,

If * is the wildcard (can be % too), try

LIKE  "*" & [prompt to the user:] & "*"

as criteria.

Hoping it may help,
Vanderghast, Access MVP

> Sorry if this is answered elsewhere, but I couldn't figure out a search
> phrase that gave me an answer.
[quoted text clipped - 13 lines]
>
> (Comment:  Lotus is much easier to use, especially something like this)
Tecknomage - 29 Mar 2006 19:04 GMT
> Hi,
>
> If * is the wildcard (can be % too), try

No.  The "*" in LIKE "*this*" = contains characters "this"

Example:  LIKE "*cat*" would return records with the characters "cat" in the
field, it would return a record with "MajorWeponCatclaw" in the field.

> LIKE  "*" & [prompt to the user:] & "*"
>
[quoted text clipped - 20 lines]
> >
> > (Comment:  Lotus is much easier to use, especially something like this)
Michel Walsh - 29 Mar 2006 20:01 GMT
Hi,

with

   LIKE  "*" & [prompt to the user:] & "*"

if the end user type

   cat

at the prompt, then a record with "MajorWeaponCatClaw"   WILL be selected,
indeed. You have tried it? That is not what you want?

Vanderghast, Access MVP

>> Hi,
>>
[quoted text clipped - 30 lines]
>> >
>> > (Comment:  Lotus is much easier to use, especially something like this)
Tom Ellison - 29 Mar 2006 20:25 GMT
Dear Teck:

Likely, you are wanting to select "words" delimited by spaces.  Is that the
case?

How about:

WHERE " " & [YourColumnName] & " " LIKE "* " & [Enter search string:  ] & "
*"

If you want to find ",this" you're going to have some work to do.  Are there
delimiters other than space?

Tom Ellison

>> Hi,
>>
[quoted text clipped - 30 lines]
>> >
>> > (Comment:  Lotus is much easier to use, especially something like this)
Chris Burnette - 28 Mar 2006 19:30 GMT
For the most part, this is fairly simple, the only thing that is tricky are
the asterisks.  If you simple put 'Like [Enter search string]' (without the
single quotes) in your query criteria, it will work.  The only caveat is that
then the user has to enter the asterisks if he wants to do a wildcard search.


If the asterisks are really crucial, then you'll probably need to put your
query into VB and assign your "This" value to a text string.  Then, you could
probably pull it off using something like:

'WHERE [MyTable].[MyField] Like [MyTable].["* & This & *"]'.  

Hope that helps.

-Chris

> Sorry if this is answered elsewhere, but I couldn't figure out a search
> phrase that gave me an answer.
[quoted text clipped - 11 lines]
>
> (Comment:  Lotus is much easier to use, especially something like this)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.