A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Search by Text String Question



 
 
Thread Tools Display Modes
  #1  
Old March 21st, 2008, 07:13 PM posted to microsoft.public.access.queries
Qaspec
external usenet poster
 
Posts: 54
Default Search by Text String Question

If column a contains a word contained in a list from a table I want another
column to list that word.

Example Table Data
Comments
Red Yellow Gray
Blue Green White


Example Table List
Red
Green

Query
Comments KeyWord
Red Yellow Gray Red
Blue Green White Green



  #2  
Old March 21st, 2008, 07:26 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Search by Text String Question

Try this --
SELECT [Table Data].Comments, [Table List].KeyWord
FROM [Table Data], [Table List]
WHERE ((([Table Data].Comments) Like "*" & [KeyWord] & "*"));

--
KARL DEWEY
Build a little - Test a little


"Qaspec" wrote:

If column a contains a word contained in a list from a table I want another
column to list that word.

Example Table Data
Comments
Red Yellow Gray
Blue Green White


Example Table List
Red
Green

Query
Comments KeyWord
Red Yellow Gray Red
Blue Green White Green



  #3  
Old March 21st, 2008, 09:00 PM posted to microsoft.public.access.queries
Qaspec
external usenet poster
 
Posts: 54
Default Search by Text String Question

Thank you that works, but I needed to change the query slightly to show the
records from Recalls where a match could not be found from tblRecallList.
This creates a lot of rows in the KeyWord column that are null. I would like
to replace those null values with the words Tracking Error. I tried an IIf
statement on the KeyWord column but i cant get it to work. Here is my SQL
now.

SELECT Recalls.Comments, tblRecallList.KeyWord
FROM Recalls LEFT JOIN tblRecallList ON Recalls.Type = tblRecallList.Type
WHERE (((Recalls.Comments) Like "*" & [KeyWord] & "*"));

"KARL DEWEY" wrote:

Try this --
SELECT [Table Data].Comments, [Table List].KeyWord
FROM [Table Data], [Table List]
WHERE ((([Table Data].Comments) Like "*" & [KeyWord] & "*"));

--
KARL DEWEY
Build a little - Test a little


"Qaspec" wrote:

If column a contains a word contained in a list from a table I want another
column to list that word.

Example Table Data
Comments
Red Yellow Gray
Blue Green White


Example Table List
Red
Green

Query
Comments KeyWord
Red Yellow Gray Red
Blue Green White Green



  #4  
Old March 21st, 2008, 09:40 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Search by Text String Question

Your keyword list can not be in tblRecallList. The yeywords must be in a
table all by themselves - here in [Table List].
SELECT Recalls.Comments
FROM (Recalls LEFT JOIN tblRecallList ON Recalls.Type = tblRecallList.Type)
LEFT JOIN [Table List] ON Recalls.Type = [Table List].KeyWord
WHERE (((Recalls.Comments) Like "*" & [KeyWord] & "*") AND
((tblRecallList.Type) Is Null));

--
KARL DEWEY
Build a little - Test a little


"Qaspec" wrote:

Thank you that works, but I needed to change the query slightly to show the
records from Recalls where a match could not be found from tblRecallList.
This creates a lot of rows in the KeyWord column that are null. I would like
to replace those null values with the words Tracking Error. I tried an IIf
statement on the KeyWord column but i cant get it to work. Here is my SQL
now.

SELECT Recalls.Comments, tblRecallList.KeyWord
FROM Recalls LEFT JOIN tblRecallList ON Recalls.Type = tblRecallList.Type
WHERE (((Recalls.Comments) Like "*" & [KeyWord] & "*"));

"KARL DEWEY" wrote:

Try this --
SELECT [Table Data].Comments, [Table List].KeyWord
FROM [Table Data], [Table List]
WHERE ((([Table Data].Comments) Like "*" & [KeyWord] & "*"));

--
KARL DEWEY
Build a little - Test a little


"Qaspec" wrote:

If column a contains a word contained in a list from a table I want another
column to list that word.

Example Table Data
Comments
Red Yellow Gray
Blue Green White


Example Table List
Red
Green

Query
Comments KeyWord
Red Yellow Gray Red
Blue Green White Green



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.