query multiple optional criteria (1 Viewer)

Pavczech

Registered User.
Local time
Today, 08:02
Joined
Jul 11, 2012
Messages
41
Hi ya

Can somebody help please.

I am trying query on multiple optional criteria. I have query where I have put criteria [Enter the First Name] or [Enter the Surname], but when I input first name and surname it shows all of them with same first names and surnames, not just that single person.

What am I trying to do is when I input first name it shows all people with same first name, when I input surname it showes all people with same surname and when I input first and last name in showes only that pearson.
Is this even possible?
Thanks
 

MStef

Registered User.
Local time
Today, 08:02
Joined
Oct 28, 2004
Messages
2,251
Look at "DemoFirstNameA20022003.mdb" (attachment, zip).
Look at Table1, Query1. Run Query1.
If you want the Firstname only, in the question for Surname
put the sign * (and vice versa).
Try with Mmmmm *
Try with * Stef
Try with * salers
Try with Andrej Kinok

Adapt it in your mdb.
 

Attachments

  • DemoFirstNameA20022003.zip
    8.1 KB · Views: 65

Brianwarnock

Retired
Local time
Today, 08:02
Joined
Jun 2, 2003
Messages
12,701
I am not in a position to look at the example at the moment but the use of * makes me suspect that the Like function is being used, in which case be prepared for partial matches. To avoid that I would use
Where (firstname=[enter first name] or [enter first name ] is null) and (surname=[enter surname] or [enter surname] is null)

Brian
 

Users who are viewing this thread

Top Bottom