MS Access search for text in field
Posted on 2012-09-15
I have this SQL statement:
Set rst3 = dbs.OpenRecordset("SELECT Customer.[ListID], Customer.[Name], Customer.[FullName] " _
& "FROM Customer;")
Assuming some data of Customer.[Name]:
I'm wondering if it's possible and, if so, how I can query the Customer.[Name] using the following:
sFirstName_BillItemLine = Trim(Split(student_name, ",")(1))
sLastName_BillItemLine = Trim(Split(student_name, ",")(0))
Assume (since I'm looping) the current variables as:
sFirstName_BillItemLine = "John"
sLastName_BillItemLine = "Smith"
So, in other words, I have to search in the table Customer where the field Customer.[Name] contains "Smith" (i.e. before the comma) and then "John" (i.e. after the comma).
How do I tackle this problem?
I'm wondering if a simple LIKE will do or is there a better way?