Help With Th Where Clause Criteria

josephbupe

Registered User.
Local time
Today, 10:05
Joined
Jan 31, 2008
Messages
247
Hi,

I am trying to construct SQL statement. The first one worked with only few criteria (PersonID, Person_LastName and Person_FirstName):

Code:
SELECT tblPersons.PersonID, tblPersons.Person_LastName, tblPersons.Person_FirstName FROM tblPersons
WHERE (((tblPersons.Person_LastName) Like [Forms]![frmFind_Persons]![Person_LastName] & "*") AND ((tblPersons.Person_FirstName) Like [Forms]![frmFind_Persons]![Person_FirstName] & "*")) ORDER BY tblPersons.Person_LastName, tblPersons.Person_FirstName;

But any more criteria added is not working at all. For instance I have added extra criteria for Person_MiddleName here but would not work:

Code:
SELECT tblPersons.PersonID, tblPersons.Person_LastName, tblPersons.Person_FirstName, tblPersons.Person_MiddleName FROM tblPersons
WHERE (((tblPersons.Person_LastName) Like [Forms]![frmFind_Persons]![Person_LastName] & "*") AND ((tblPersons.Person_FirstName) Like [Forms]![frmFind_Persons]![Person_FirstName] & "*") AND ((tblPersons.Person_MiddleName) Like [Forms]![frmFind_Persons]![Person_MiddleName] & "*")) ORDER BY tblPersons.Person_LastName, tblPersons.Person_FirstName;

I will appreciate your help.

Joseph.
 
Inefficient query using too many LIKEs.

You mentioned it doesn't work, what doesn't work? What is the error?

Is Person_MiddleName a field in your tblPersons table?
 
I suspect that you have some Null middle names, Like will not return Nulls.

you may want to read this thread as it explains the options better than I

Brian
 

Users who are viewing this thread

Back
Top Bottom