Parameter Query - if Null show all (1 Viewer)

QBC

New member
Local time
Today, 05:40
Joined
Aug 23, 2009
Messages
9
Hello everyone,
Im running a parameter query and I need it to show all records if left blank by the user.
I can achieve this but I cannot achieve it for more than one parameter.
How do i go about this?

Basically, if the user enters a value for the first parameter and enters nothing on the second one, i'd like to see all values for the first parameter.

any thoughts?

as always, much appreciated.
 

John Big Booty

AWF VIP
Local time
Today, 22:40
Joined
Aug 29, 2005
Messages
8,262
Use;
Code:
Like [URL="http://www.techonthenet.com/access/functions/advanced/nz.php"]Nz[/URL]([Enter a Search Value],"*")
as you criteria. If you want all values from a field that is left blank you will need to step each of your Criteria down one line so that you have an Or operator rather than an And operator
 

marylynn

New member
Local time
Today, 06:40
Joined
Nov 20, 2012
Messages
8
Love the simplicity and it works so well.
Thank you so much!:eek:
 

Brianwarnock

Retired
Local time
Today, 13:40
Joined
Jun 2, 2003
Messages
12,701
It may be simple but I would not use it as Like can bring back partial string matches. Also to quote Pat Hartman

1. Do NOT use LIKE unless you really need it. It can cause full table scans and prevent Jet/ACE from using any indexes. If you need it, you need it, and are willing to pay the price but it should NEVER be your default.

I always use

Field = parameter or parameter is null
Type syntax

Brian
 

Users who are viewing this thread

Top Bottom