similar text

Jake55923

New member
Local time
Today, 13:29
Joined
Jan 30, 2004
Messages
9
I am building a query and don't know how to return all records that have text that is similar to a user-entered parameter.
For example, I have a text box named Defect where the user enters the defect they wish to search for. If the user enters "broken", I would want to see all records that include "broken filament", "broken ends", etc.

This is the statement that I currently have:
strSQL = "SELECT [tbl RA Data].[Defect 1] FROM [tbl RA Data] WHERE [Defect 1] = '" & Me![Defect] & "' ORDER BY [tbl RA Data].[Defect 1], [tbl RA Data].Year, [tbl RA Data].Period"


Thanks!
Jake
 
strSQL = "SELECT [tbl RA Data].[Defect 1] FROM [tbl RA Data] WHERE [Defect 1] Like '" & Me![Defect] & "*' ORDER BY [tbl RA Data].[Defect 1], [tbl RA Data].Year, [tbl RA Data].Period"

The general syntax you are looking for is:
WHERE [field] Like "[user_entry]*"
 
Jake55923 said:

This is the statement that I currently have:
strSQL = "SELECT [tbl RA Data].[Defect 1] FROM [tbl RA Data] WHERE [Defect 1] = '" & Me![Defect] & "' ORDER BY [tbl RA Data].[Defect 1], [tbl RA Data].Year, [tbl RA Data].Period"
Thanks!
Jake


strSQL = "SELECT [tbl RA Data].[Defect 1] FROM [tbl RA Data] WHERE [Defect 1] Like '" & Me![Defect] & "' ORDER BY [tbl RA Data].[Defect 1], [tbl RA Data].Year, [tbl RA Data].Period"
 
Bugger beaten by that darn penguin again! :mad: :D
 
dan-cat, what is your avatar? An elephant with large ears?
 

Users who are viewing this thread

Back
Top Bottom