Designing a keyord search query in Access

Designing a keyord search query in Access

I’m still quite new to using SQL and I am designing a database in which I am cataloging resources owned by my company. I am attempting to create a query that will allow the user to enter a value such as an author’s name and have the query search the author’s field to provide all records with that author’s name. My problem is that when I set a parameter and run the query, the prompt shows up and requests that the user enter the parameter. This part is fine, however, it only works if the parameter value is exactly what was entered by the user. For example if the Authors name is John Smith, but at the prompt the user enters only Smith, no records appear. I am designing in Access.

It sounds to me like you need the LIKE comparison operator with a “%” (percent sign) on both sides of the thing you want to test like this:

SELECT framisFROM foobarWHERE foobar.framis LIKE %SMITH% 

This will retrieve Smithson, Winesmith and Smith.

See also  Does It Make Sense to Splurge on a Laptop?

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist