And, Like and Is Null (1 Viewer)

bees292

Registered User.
Local time
Today, 19:45
Joined
Jul 26, 2005
Messages
30
Hi

I've searched this forum but dont seem to be able to find the right info on this....

I have a form that passes parameters to a query (a user search form). I want it to display records based on the following criteria:

1. If Null display all the records
2. Use wildcard values (i.e. "Blog" would return "Bloggs")

I'm using this criteria at the moment:

[Author] Like [forms]![Search].[Author] Or [forms]![Search].[Author] Is Null

But the wildcard bit doesn't seem to work. I'm sure I need some kind of 'Or "*"' instead of 'Like' but need some expert help.

I have searched on this extensively but apologise if I've missed something.

Cheers
 

sportsguy

Finance wiz, Access hack
Local time
Today, 14:45
Joined
Dec 28, 2004
Messages
363
Where Clause

Like [Forms]![Search].[Author] & "*"
returns all records that begin with [Forms]![Search].[Author]
AND all records if [Author] Is Null

Like "*" & [Forms]![Search].[Author] & "*"
returns all records that contain [Forms]![Search].[Author]
AND all records if [Author] Is Null

Like "*" & [Forms]![Search].[Author]
returns all records that end with [Forms]![Search].[Author]
AND all records if [Author] Is Null

sportsguy
 

bees292

Registered User.
Local time
Today, 19:45
Joined
Jul 26, 2005
Messages
30
well that was simple. Many thanks.
 

bees292

Registered User.
Local time
Today, 19:45
Joined
Jul 26, 2005
Messages
30
Yes that works very well but any ideas on how I might do this....

If the user inputs two words (or names in this case) such as "Bloggs Smith", how could I get it to return records with Bloggs & Smith in whatever order they were input?

Example:

Author: Smith, Medin & Rose

User searches: Smith Rose ..........and it returns a hit for Smith, Medin and Rose.

Without trying I'm pretty sure the above code would not work. I know this is a different problem (i.e. one about passing multiple search criteria from the same text box) but any ideas. Maybe the Author field would be better not as a text but as a seperate linked table so each record can have multiple Authors?

Thanks
 

Users who are viewing this thread

Top Bottom