COPIED FROM Setup Keyword Search
It makes things much, much easier.
Next question: Why the extra table for entering key words? Do you want to save this criteria for later use?
If not, just define a global field for your list of keywords. Put a second global field on this layout for the user to use to select the desired table. You can format this field with a drop down of table or layout names.
Your script then follows this basic outline:
Use the global field of table names to select the correct layout (you'll need a different layout for each table on which the user might search.) Use either a series of If -Else If statments to select the correct layout or you can use Go To Layout with the "layout name by calculation" option if the global field's value list lists the actual names of the layouts.
The rest of your script then does this:
Set Variable [$Keywords ; Substitute ( YourTable::gKeywords ; "," ; ¶ ) ]
Enter Find Mode//clear the pause check box
Set Variable [ $I ; $I + 1 ]
SetFieldByName [//Expression that computes Name of Table::Field from user choice in global layout field ; Getvalue ( $Keywords ; $I )]
Exit Loop If [$I > ValueCount ( $Keywords ) ]
Set Error Capture [on]
This will find all records on the selected table if the record contains keyword 1, or keyword 2 or....
If you want the keyword search applied to multiple fields in the same record, define a calculation field in each table defined to combine all the searchable fields into a single concatenated block of text: List ( Field1 ; Field2 ; Field 3; ...) or Field 1 & " " & Field 2 & .... and do your search on this field.
Edit note: left out script step in Red originally.