2012年3月6日星期二

Any part of field" match

How can I make my search button have the "Any part of field" match as a default? with a simple query...

I have a field in MS access with hundreds of words (cv)... I want to be able to find a word in "Any part of field"

my try:

WHERE ((([cv].[detail cv])=[detail]));

detail is nowhere to find... i am prompt to give a value. fine.but it
equals whole field; detail must be the sole value of the field detail cv...

help!

mchelIf you are patient enough to wait for the results, try using the LIKE clause.

-PatP|||what do you mean ? I dont know in advance what is the value ...

do you have an example ?|||See MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oledb/htm/oledbprovjet_sql_support.asp).

-PatP|||Try

WHERE [cv].[detail cv]) LIKE '%whatever_word_you_want%'

but as Pat said, prepare for a long wait if there are many records. Full Text Indexing is another option although I haven't used it much. It's much faster than the above method when doing frequent searches.|||This is the SQLServer forum, not de Acces (bleah...) forum, but anyway:

select ... from ... where [Field] like '*' & trim([ParamName]) & '*'.

PS
In SqlServer '%' is the wildcard for anything, but in Access is '*'. Why the hell Bill considered to use different chars for wildcards in every SGBD that he owns, I don't really know.|||what is SGBD?|||Access 97 did use the asterisk (*) as it's wildcard character. Uncle Bill changed this in Access 2002 and it now is the percent sign (%). This was not well documented but welcome all the same.

To clarify a bit more, the change occurred in the switch from JET 3.5 to JET 4.0, not really in Access, which is just a GUI into JET like Enterprise Manager is to SQL Server.

没有评论:

发表评论