Solved

Search a certain word in a field...

Posted on 2002-05-19
9
157 Views
Last Modified: 2010-04-04
Hi experts,

How to search a certain word in a field of a record?

Field | Title                     | Year |
Data  | Monkey in the blue bottle | 1997 |

I just entered 'blue' and it will come out the above data.
I'm using D3 and MSAccess database.

TQ

iqmedia
0
Comment
Question by:iqmedia
9 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 7019411
select * from atable where fieldname like "%TheWord%"
0
 

Author Comment

by:iqmedia
ID: 7019415
Hi kretzschmar,

You're fast...

Is that all???? shisssss.... OK I'll try it first.

TQ expert.

iqmedia
0
 

Author Comment

by:iqmedia
ID: 7019417
Hi kretzschmar,

You're fast...

Is that all???? shisssss.... OK I'll try it first.

TQ expert.

iqmedia
0
 
LVL 4

Expert Comment

by:nestorua
ID: 7019741
HI,
Another method (in this case you don't need to change your
SQL if you use someone):
in the OnFilterRecord event of your TDataset write the following:
Accept:=Pos('blue', Dataset.FieldByName('Title').AsString)>0.
Sincerely,
Nestorua.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7019882
Hello

  if you are using Access database, you have to use * instead of %
 your SQL statment will be as:

Select * from urTable where Title like '*blue*'

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7019928
% does also work with access databases
(via ado tested)

meikl ;-)
0
 

Author Comment

by:iqmedia
ID: 7020921
Hi experts...

i got stuck yesterday and with these all comment i'll try to do it again... TQ experts.

iqmedia
0
 

Author Comment

by:iqmedia
ID: 7026457
Hi experts,

I got this error by doing that:
General SQL Error [Microsoft][ODBC Microsoft Access 97 Driver] Expression cannot be used with the LIKE predicate.

but then I change Access 97 to Paradox 7 and do this, and it work:

var wordtofind : string;
begin
  Edit1.Text := wordtofind;
  with Query1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('SELECT * FROM tableBook');
    SQL.Add('WHERE Title LIKE "%' + wordtofind + '%"');
    Open;
  end;
end;

iqmedia
0
 

Author Comment

by:iqmedia
ID: 7026459
I think this would be enough.. TQ

iqmedia
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now