Forum Discussion

Johnqui1790's avatar
Johnqui1790
Copper Contributor
Oct 28, 2021

Finding a field of keywords in a long text field

Hi all,

 

I have a list of thousands of keywords in one field.  On another table, I have a field listing thousands of long text records.  Ultimately, I want the database to return every time a keyword is found in a long text record and tell me which keyword matched.  I think I have created a query to find all the matching keywords in the long text records but cannot figure out how to tell me which keywords matched.

 

WHERE (((Longtext_Table.Longtext_Field) Like "*[Keywords_Table].[Keywords_Field]*"));

 

I cannot figure out how to get Access to return which keywords were found in each long text record.  Does anyone have any ideas?

 

1 Reply

  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor

    Johnqui1790 
    May I restate the requirement slightly to see if I understand correctly.

     

    You can create a query that filters the long text field (and I'll bet that the real name is NOT actually Longtext_Field and that you've aliased it for "simplicity") so that the recordset returns all of the fields which match one or more of the keywords. What you need, in addition to the field itself, is the identification of the records in that table; in other words, the returned recordset needs to include two fields:

    a) the field in question and

    b) the PRIMARY KEY of the record 

     

    So, if you add the PK from "Longtext_Table" to the query, you'd probably get what you want.

Resources