Parameter Query prompt - How to let user select all

  • Thread starter Thread starter Astello
  • Start date Start date
A

Astello

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee
 
Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


Astello said:
I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







Astello said:
Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


Astello said:
I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));

hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







Astello said:
Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


Astello said:
Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));

hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







Astello said:
Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


Astello said:
Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));

hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
hi,

That should not be happening, but I suppose your IIF statements are not
consistent. Post the whole SQL, and I will amend to new recommendation. We
will have a simpler SQL.

Thanks


Astello said:
i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


Astello said:
Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));


geebee wrote:
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
i might just be an idiot, when i sent you the original statement i
substituted "DataTable" for the real name of my database, which is long
and complicated. once i changed DataTable back to the original name,
it worked perfectly. Thanks so much for all your help.

Here's another quick question you might know the answer to:
Is there a way to allow the user to enter one, multiple or "all" in the
parameter query, without restricting the number of possible entries?
hi,

That should not be happening, but I suppose your IIF statements are not
consistent. Post the whole SQL, and I will amend to new recommendation. We
will have a simpler SQL.

Thanks


Astello said:
i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


:

Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));


geebee wrote:
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
i had a couple fixes i need to make (i put DataTable as a place holder
for longer, complicated table name, and didn't change it back). but
now, when prompted, i enter values into the parameter boxes but it's
doesn't discriminate, no matter what i type in it includes all of my
data. here is the query code:

SELECT
[*2005 Cleansed Paid Data YTD].[Division Name],
[*2005 Cleansed Paid Data YTD].Type,
[*2005 Cleansed Paid Data YTD].[Dest ST],
[*2005 Cleansed Paid Data YTD].[Dest Zip],
INTO
CostModelData
FROM
[*2005 Cleansed Paid Data YTD]
WHERE
((([*2005 Cleansed Paid Data YTD].[Division Name])=IIf([Division Name?]
Is Null Or [Division Name?]="all",[Division Name],[Division Name?])))
OR ((([*2005 Cleansed Paid Data YTD].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type],[Type?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest ST])=IIf([Destination
State?] Is Null Or [Destination State?]="all",[Dest ST],[Destination
State?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest Zip])=IIf([Destination Zip?]
Is Null Or Destination Zip?]="all",[Dest Zip],[Destination Zip?])));
hi,

That should not be happening, but I suppose your IIF statements are not
consistent. Post the whole SQL, and I will amend to new recommendation. We
will have a simpler SQL.

Thanks


Astello said:
i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


:

Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));


geebee wrote:
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
hi,

I am sure there is a way, but this would involve some VB coding. Can you
explain why you are wanting to do this, so I can better understand?

In the meantime, there is a TOP N query, but this limits the results before
runtime to a predetermined number of rows retrieved by the query. For
example,

SELECT TOP 5
FROM
WHERE...

returns 5 rows.

Thanks



Astello said:
i might just be an idiot, when i sent you the original statement i
substituted "DataTable" for the real name of my database, which is long
and complicated. once i changed DataTable back to the original name,
it worked perfectly. Thanks so much for all your help.

Here's another quick question you might know the answer to:
Is there a way to allow the user to enter one, multiple or "all" in the
parameter query, without restricting the number of possible entries?
hi,

That should not be happening, but I suppose your IIF statements are not
consistent. Post the whole SQL, and I will amend to new recommendation. We
will have a simpler SQL.

Thanks


Astello said:
i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...

geebee wrote:
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


:

Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));


geebee wrote:
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
this query is the first step in a model-of-sorts that i'm making, every
time the model is run, the query needs to pull data from the database
allowing the user to look at:

one division or all divisions at once
one type of transportation or all
one destination state or all
one destination zip code or all

then this information goes into another program for formatting and
another for cost analysis.
this is something i'm passing off to management when it's finished, and
the user needs to flexibility to look at various sample sets whenever
they run the model. does that make sense?
hi,

I am sure there is a way, but this would involve some VB coding. Can you
explain why you are wanting to do this, so I can better understand?

In the meantime, there is a TOP N query, but this limits the results before
runtime to a predetermined number of rows retrieved by the query. For
example,

SELECT TOP 5
FROM
WHERE...

returns 5 rows.

Thanks



Astello said:
i might just be an idiot, when i sent you the original statement i
substituted "DataTable" for the real name of my database, which is long
and complicated. once i changed DataTable back to the original name,
it worked perfectly. Thanks so much for all your help.

Here's another quick question you might know the answer to:
Is there a way to allow the user to enter one, multiple or "all" in the
parameter query, without restricting the number of possible entries?
hi,

That should not be happening, but I suppose your IIF statements are not
consistent. Post the whole SQL, and I will amend to new recommendation. We
will have a simpler SQL.

Thanks


:

i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...

geebee wrote:
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


:

Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));


geebee wrote:
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
hi,

You are missing a bracket in the last line of your query...so change to ...

Is Null Or [Destination Zip?]="all",[Dest Zip],[Destination Zip?])));

After that, pick a record from the TABLE, and write down the values of a
record as seen in the 3 columns you have parameters on. For example, choose
a record, and write down the value of [Type] for that record. Choose another
record, and write down the value of [Dest ST] for that record. Then choose
another record, and write down the value of [Dest Zip] for that records.
Then run your query, and when prompted type in the 3 values as found in the 3
records respectively. You are guaranteed to get something if your Syntax is
correct, and provided that the name of your TABLE is in the query syntax.

geebee


Astello said:
i had a couple fixes i need to make (i put DataTable as a place holder
for longer, complicated table name, and didn't change it back). but
now, when prompted, i enter values into the parameter boxes but it's
doesn't discriminate, no matter what i type in it includes all of my
data. here is the query code:

SELECT
[*2005 Cleansed Paid Data YTD].[Division Name],
[*2005 Cleansed Paid Data YTD].Type,
[*2005 Cleansed Paid Data YTD].[Dest ST],
[*2005 Cleansed Paid Data YTD].[Dest Zip],
INTO
CostModelData
FROM
[*2005 Cleansed Paid Data YTD]
WHERE
((([*2005 Cleansed Paid Data YTD].[Division Name])=IIf([Division Name?]
Is Null Or [Division Name?]="all",[Division Name],[Division Name?])))
OR ((([*2005 Cleansed Paid Data YTD].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type],[Type?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest ST])=IIf([Destination
State?] Is Null Or [Destination State?]="all",[Dest ST],[Destination
State?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest Zip])=IIf([Destination Zip?]
Is Null Or Destination Zip?]="all",[Dest Zip],[Destination Zip?])));
hi,

That should not be happening, but I suppose your IIF statements are not
consistent. Post the whole SQL, and I will amend to new recommendation. We
will have a simpler SQL.

Thanks


Astello said:
i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...

geebee wrote:
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


:

Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));


geebee wrote:
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
fixed the bracket problem.

i did what you said, and i think the problem is that when i type in
constraints for all of the fields, it's pulling up all records with any
of the parameters, not with all of the parameters. does that shed some
light on my problem? or maybe we're not on the same page about what
i'm trying to accomplish.
hi,

You are missing a bracket in the last line of your query...so change to ...

Is Null Or [Destination Zip?]="all",[Dest Zip],[Destination Zip?])));

After that, pick a record from the TABLE, and write down the values of a
record as seen in the 3 columns you have parameters on. For example, choose
a record, and write down the value of [Type] for that record. Choose another
record, and write down the value of [Dest ST] for that record. Then choose
another record, and write down the value of [Dest Zip] for that records.
Then run your query, and when prompted type in the 3 values as found in the 3
records respectively. You are guaranteed to get something if your Syntax is
correct, and provided that the name of your TABLE is in the query syntax.

geebee


Astello said:
i had a couple fixes i need to make (i put DataTable as a place holder
for longer, complicated table name, and didn't change it back). but
now, when prompted, i enter values into the parameter boxes but it's
doesn't discriminate, no matter what i type in it includes all of my
data. here is the query code:

SELECT
[*2005 Cleansed Paid Data YTD].[Division Name],
[*2005 Cleansed Paid Data YTD].Type,
[*2005 Cleansed Paid Data YTD].[Dest ST],
[*2005 Cleansed Paid Data YTD].[Dest Zip],
INTO
CostModelData
FROM
[*2005 Cleansed Paid Data YTD]
WHERE
((([*2005 Cleansed Paid Data YTD].[Division Name])=IIf([Division Name?]
Is Null Or [Division Name?]="all",[Division Name],[Division Name?])))
OR ((([*2005 Cleansed Paid Data YTD].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type],[Type?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest ST])=IIf([Destination
State?] Is Null Or [Destination State?]="all",[Dest ST],[Destination
State?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest Zip])=IIf([Destination Zip?]
Is Null Or Destination Zip?]="all",[Dest Zip],[Destination Zip?])));
hi,

That should not be happening, but I suppose your IIF statements are not
consistent. Post the whole SQL, and I will amend to new recommendation. We
will have a simpler SQL.

Thanks


:

i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...

geebee wrote:
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


:

Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));


geebee wrote:
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
hi,

If you want to make it to where a single record meets ALL of the parameters,
then change the WHERE clause to...

WHERE
((([*2005 Cleansed Paid Data YTD].[Division Name])=IIf([Division Name?]
Is Null Or [Division Name?]="all",[Division Name],[Division Name?])))
AND ((([*2005 Cleansed Paid Data YTD].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type],[Type?])))
AND ((([*2005 Cleansed Paid Data YTD].[Dest ST])=IIf([Destination
State?] Is Null Or [Destination State?]="all",[Dest ST],[Destination
State?])))
AND ((([*2005 Cleansed Paid Data YTD].[Dest Zip])=IIf([Destination Zip?]
Is Null Or [Destination Zip?]="all",[Dest Zip],[Destination Zip?])));

In this case you simply replace the 3 "OR" to "AND", thus making it to where
the row returned has to meet ALL criteria, instead of having to meet any ONE
criteria.

geebee


Astello said:
fixed the bracket problem.

i did what you said, and i think the problem is that when i type in
constraints for all of the fields, it's pulling up all records with any
of the parameters, not with all of the parameters. does that shed some
light on my problem? or maybe we're not on the same page about what
i'm trying to accomplish.
hi,

You are missing a bracket in the last line of your query...so change to ...

Is Null Or [Destination Zip?]="all",[Dest Zip],[Destination Zip?])));

After that, pick a record from the TABLE, and write down the values of a
record as seen in the 3 columns you have parameters on. For example, choose
a record, and write down the value of [Type] for that record. Choose another
record, and write down the value of [Dest ST] for that record. Then choose
another record, and write down the value of [Dest Zip] for that records.
Then run your query, and when prompted type in the 3 values as found in the 3
records respectively. You are guaranteed to get something if your Syntax is
correct, and provided that the name of your TABLE is in the query syntax.

geebee


Astello said:
i had a couple fixes i need to make (i put DataTable as a place holder
for longer, complicated table name, and didn't change it back). but
now, when prompted, i enter values into the parameter boxes but it's
doesn't discriminate, no matter what i type in it includes all of my
data. here is the query code:

SELECT
[*2005 Cleansed Paid Data YTD].[Division Name],
[*2005 Cleansed Paid Data YTD].Type,
[*2005 Cleansed Paid Data YTD].[Dest ST],
[*2005 Cleansed Paid Data YTD].[Dest Zip],
INTO
CostModelData
FROM
[*2005 Cleansed Paid Data YTD]
WHERE
((([*2005 Cleansed Paid Data YTD].[Division Name])=IIf([Division Name?]
Is Null Or [Division Name?]="all",[Division Name],[Division Name?])))
OR ((([*2005 Cleansed Paid Data YTD].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type],[Type?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest ST])=IIf([Destination
State?] Is Null Or [Destination State?]="all",[Dest ST],[Destination
State?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest Zip])=IIf([Destination Zip?]
Is Null Or Destination Zip?]="all",[Dest Zip],[Destination Zip?])));

geebee wrote:
hi,

That should not be happening, but I suppose your IIF statements are not
consistent. Post the whole SQL, and I will amend to new recommendation. We
will have a simpler SQL.

Thanks


:

i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...

geebee wrote:
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


:

Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));


geebee wrote:
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 
thank you so much! the query works finally. such a simple solution,
too. i really appreciate all the time you spent on this.
hi,

If you want to make it to where a single record meets ALL of the parameters,
then change the WHERE clause to...

WHERE
((([*2005 Cleansed Paid Data YTD].[Division Name])=IIf([Division Name?]
Is Null Or [Division Name?]="all",[Division Name],[Division Name?])))
AND ((([*2005 Cleansed Paid Data YTD].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type],[Type?])))
AND ((([*2005 Cleansed Paid Data YTD].[Dest ST])=IIf([Destination
State?] Is Null Or [Destination State?]="all",[Dest ST],[Destination
State?])))
AND ((([*2005 Cleansed Paid Data YTD].[Dest Zip])=IIf([Destination Zip?]
Is Null Or [Destination Zip?]="all",[Dest Zip],[Destination Zip?])));

In this case you simply replace the 3 "OR" to "AND", thus making it to where
the row returned has to meet ALL criteria, instead of having to meet any ONE
criteria.

geebee


Astello said:
fixed the bracket problem.

i did what you said, and i think the problem is that when i type in
constraints for all of the fields, it's pulling up all records with any
of the parameters, not with all of the parameters. does that shed some
light on my problem? or maybe we're not on the same page about what
i'm trying to accomplish.
hi,

You are missing a bracket in the last line of your query...so change to ...

Is Null Or [Destination Zip?]="all",[Dest Zip],[Destination Zip?])));

After that, pick a record from the TABLE, and write down the values of a
record as seen in the 3 columns you have parameters on. For example, choose
a record, and write down the value of [Type] for that record. Choose another
record, and write down the value of [Dest ST] for that record. Then choose
another record, and write down the value of [Dest Zip] for that records.
Then run your query, and when prompted type in the 3 values as found in the 3
records respectively. You are guaranteed to get something if your Syntax is
correct, and provided that the name of your TABLE is in the query syntax.

geebee


:

i had a couple fixes i need to make (i put DataTable as a place holder
for longer, complicated table name, and didn't change it back). but
now, when prompted, i enter values into the parameter boxes but it's
doesn't discriminate, no matter what i type in it includes all of my
data. here is the query code:

SELECT
[*2005 Cleansed Paid Data YTD].[Division Name],
[*2005 Cleansed Paid Data YTD].Type,
[*2005 Cleansed Paid Data YTD].[Dest ST],
[*2005 Cleansed Paid Data YTD].[Dest Zip],
INTO
CostModelData
FROM
[*2005 Cleansed Paid Data YTD]
WHERE
((([*2005 Cleansed Paid Data YTD].[Division Name])=IIf([Division Name?]
Is Null Or [Division Name?]="all",[Division Name],[Division Name?])))
OR ((([*2005 Cleansed Paid Data YTD].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type],[Type?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest ST])=IIf([Destination
State?] Is Null Or [Destination State?]="all",[Dest ST],[Destination
State?])))
OR ((([*2005 Cleansed Paid Data YTD].[Dest Zip])=IIf([Destination Zip?]
Is Null Or Destination Zip?]="all",[Dest Zip],[Destination Zip?])));

geebee wrote:
hi,

That should not be happening, but I suppose your IIF statements are not
consistent. Post the whole SQL, and I will amend to new recommendation. We
will have a simpler SQL.

Thanks


:

i changed my WHERE statement to the one you gave me, but it still
prompts twice for each field:

DataTable.Type
Type?
DataTable.DestST
Destination State?
*DataTable.DestZip
Destination Zip?

and if i leave them all blank, it excludes all of my data. i'm so
lost...

geebee wrote:
hi,

Change your WHERE clause to:

WHERE ((([DataTable].Type)=
IIf([Type?] Is Null Or
[Type?]="all",[Type], [Type?]))
OR (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST], [Destination State?]))
OR (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip], [Destination Zip?])));

Simply using [enter] as parameter promts in your case is different from your
parameter promts of [Type?], [Destination State?] and [Destination Zip?].
That's why it was prompting you 3 times, because you never initially used
them, and they were different from your custom parameter prompts.

geebee


:

Below is my WHERE statement. If I left in the [enter] at the end of
each part, an extra parameter box popped up every time the query ran.
However, when I take it out, rather that thinking "all" or "blank"
include everything, it sees them as including nothing. Anything you
can see wrong?

Thanks!

WHERE ((([DataTable].Type)=IIf([Type?] Is Null Or
[Type?]="all",[Type]))
And (([DataTable].[Dest ST])=IIf([Destination State?] Is Null Or
[Destination State?]="all",[Dest ST]))
And (([*DataTable].[Dest Zip])=IIf([Destination Zip?] Is Null Or
[Destination Zip?]="all",[Dest Zip])));


geebee wrote:
hi,

Yes,

You can replace "test" with your table name. And "city" with any table
column name you have. For example, you can use multiple parameters for as
many columns as you want.

For example, the following WHERE clause allows the user to enter 2
parameters for the query. One to filter the [city] column and the other to
filter the [num] column:

WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])))
OR (((test.num)=IIf([enter2] Is Null Or [enter2]="all",[num],[enter2])));


Hope this helps,
geebee







:

Is "test" the name of my query, and "city" the field? Thanks so much
for replying to me.

geebee wrote:
hi,

Here is a sample query... You can adapt the syntax for your own use/query...

SELECT test.city
FROM test
WHERE (((test.city)=IIf([enter] Is Null Or [enter]="all",[city],[enter])));

Hope this helps,
geebee


:

I want to set multiple parameter queries, and allow the user to enter a
parameter for each of them or to select all if they don't want to limit
that field. What does the user type in if they want to see all in that
field? Or if they leave it blank, is there a way to code that "blank"
means "all"? Thanks so much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top