like "*"

  • Thread starter Thread starter Netalie
  • Start date Start date
N

Netalie

Hi,

I have a form, holding criteria combo's for a query.
I want to define, that if a user leaves one of them
blank, the it won't effect the query's data, meaning, it
would be as if he entered like "*" to the criteria row.

How can i define this?
thanks
 
Here is an example of the criteria for the field.

Like (IIf(IsNull([Forms]![Form1]![Text0]),"*",[Forms]![Form1]![Text0]))
 
Please post the SQL of your query. I tried what I sent you before I sent it to make sure
there weren't any typos. It works.

--
Wayne Morgan
Microsoft Access MVP


netalie said:
Yes, i have tried all those trickes, it doesnt work
-----Original Message-----
Here is an example of the criteria for the field.

Like (IIf(IsNull([Forms]![Form1]![Text0]),"*",[Forms]! [Form1]![Text0]))

--
Wayne Morgan
Microsoft Access MVP


Netalie said:
Hi,

I have a form, holding criteria combo's for a query.
I want to define, that if a user leaves one of them
blank, the it won't effect the query's data, meaning, it
would be as if he entered like "*" to the criteria row.

How can i define this?
thanks


.
 
Hi wayne,

I'm not using the sql window, im using the query design
grid. I have entered the If condition in the criteria
row, under the relevant field. and it doesnt work...

-----Original Message-----
Please post the SQL of your query. I tried what I sent
you before I sent it to make sure
there weren't any typos. It works.

--
Wayne Morgan
Microsoft Access MVP


netalie said:
Yes, i have tried all those trickes, it doesnt work
-----Original Message-----
Here is an example of the criteria for the field.

Like (IIf(IsNull([Forms]![Form1]![Text0]),"*",[Forms]! [Form1]![Text0]))

--
Wayne Morgan
Microsoft Access MVP


Hi,

I have a form, holding criteria combo's for a query.
I want to define, that if a user leaves one of them
blank, the it won't effect the query's data,
meaning,
it
would be as if he entered like "*" to the criteria row.

How can i define this?
thanks


.


.
 
Hi wayne,

Here's the sql:

SELECT Customers.[Customer Number], Customers.[Type of
Customer], Customers.Region
FROM Customers
WHERE (((Customers.[Customer Number])=IIf([Forms]![Form1]!
[Text0]=Null,"*",[Forms]![Form1]![Text0])));

It's a numeric type, and the form is open. i have tried
all kind of "tricks" with this condition, nothing is
accepted as like "*".
-----Original Message-----
I understand you are using the query design grid, but it
is hard to send as text to this
newsgroup. With the query open in design mode, go to the View menu and select SQL View.
This will show you the SQL behind your query. You can
copy and paste that into a message.
Also, is the form open when you try to read the data
from it? When you say it doesn't
work, what does or doesn't happen? Do you get any error messages? Is the value you are
trying to filter text or numeric?

--
Wayne Morgan
Microsoft Access MVP


netalie said:
Hi wayne,

I'm not using the sql window, im using the query design
grid. I have entered the If condition in the criteria
row, under the relevant field. and it doesnt work...

-----Original Message-----
Please post the SQL of your query. I tried what I sent
you before I sent it to make sure
there weren't any typos. It works.

--
Wayne Morgan
Microsoft Access MVP


Yes, i have tried all those trickes, it doesnt work

-----Original Message-----
Here is an example of the criteria for the field.

Like (IIf(IsNull([Forms]![Form1]![Text0]),"*", [Forms]!
[Form1]![Text0]))

--
Wayne Morgan
Microsoft Access MVP


Hi,

I have a form, holding criteria combo's for a query.
I want to define, that if a user leaves one of them
blank, the it won't effect the query's data, meaning,
it
would be as if he entered like "*" to the
criteria
row.
How can i define this?
thanks


.



.


.
 
Try this instead:

SELECT Customers.[Customer Number], Customers.[Type of
Customer], Customers.Region
FROM Customers
WHERE (((Customers.[Customer Number]) Like
(IIf(IsNull([Forms]![Form1]![Text0]),"*",[Forms]![Form1]![Text0]));

Also, you will (of course) have to substitute Form1 and Text0 with the correct names for
your form and control.

--
Wayne Morgan
Microsoft Access MVP


netalie said:
Hi wayne,

Here's the sql:

SELECT Customers.[Customer Number], Customers.[Type of
Customer], Customers.Region
FROM Customers
WHERE (((Customers.[Customer Number])=IIf([Forms]![Form1]!
[Text0]=Null,"*",[Forms]![Form1]![Text0])));

It's a numeric type, and the form is open. i have tried
all kind of "tricks" with this condition, nothing is
accepted as like "*".
-----Original Message-----
I understand you are using the query design grid, but it
is hard to send as text to this
newsgroup. With the query open in design mode, go to the View menu and select SQL View.
This will show you the SQL behind your query. You can
copy and paste that into a message.
Also, is the form open when you try to read the data
from it? When you say it doesn't
work, what does or doesn't happen? Do you get any error messages? Is the value you are
trying to filter text or numeric?

--
Wayne Morgan
Microsoft Access MVP


netalie said:
Hi wayne,

I'm not using the sql window, im using the query design
grid. I have entered the If condition in the criteria
row, under the relevant field. and it doesnt work...


-----Original Message-----
Please post the SQL of your query. I tried what I sent
you before I sent it to make sure
there weren't any typos. It works.

--
Wayne Morgan
Microsoft Access MVP


Yes, i have tried all those trickes, it doesnt work

-----Original Message-----
Here is an example of the criteria for the field.

Like (IIf(IsNull([Forms]![Form1]![Text0]),"*", [Forms]!
[Form1]![Text0]))

--
Wayne Morgan
Microsoft Access MVP


Hi,

I have a form, holding criteria combo's for a query.
I want to define, that if a user leaves one of them
blank, the it won't effect the query's data,
meaning,
it
would be as if he entered like "*" to the criteria
row.

How can i define this?
thanks


.



.


.
 
Hi,

this gave me a syntax error, but i did use the isnull
function other then the =null. and it works,

Thanks!

-----Original Message-----
Try this instead:

SELECT Customers.[Customer Number], Customers.[Type of
Customer], Customers.Region
FROM Customers
WHERE (((Customers.[Customer Number]) Like
(IIf(IsNull([Forms]![Form1]![Text0]),"*",[Forms]![Form1]! [Text0]));

Also, you will (of course) have to substitute Form1 and
Text0 with the correct names for
your form and control.

--
Wayne Morgan
Microsoft Access MVP


netalie said:
Hi wayne,

Here's the sql:

SELECT Customers.[Customer Number], Customers.[Type of
Customer], Customers.Region
FROM Customers
WHERE (((Customers.[Customer Number])=IIf([Forms]! [Form1]!
[Text0]=Null,"*",[Forms]![Form1]![Text0])));

It's a numeric type, and the form is open. i have tried
all kind of "tricks" with this condition, nothing is
accepted as like "*".
-----Original Message-----
I understand you are using the query design grid, but
it
is hard to send as text to this
newsgroup. With the query open in design mode, go to
the
View menu and select SQL View.
This will show you the SQL behind your query. You can
copy and paste that into a message.
Also, is the form open when you try to read the data
from it? When you say it doesn't
work, what does or doesn't happen? Do you get any
error
messages? Is the value you are
trying to filter text or numeric?

--
Wayne Morgan
Microsoft Access MVP


Hi wayne,

I'm not using the sql window, im using the query design
grid. I have entered the If condition in the criteria
row, under the relevant field. and it doesnt work...


-----Original Message-----
Please post the SQL of your query. I tried what I sent
you before I sent it to make sure
there weren't any typos. It works.

--
Wayne Morgan
Microsoft Access MVP


Yes, i have tried all those trickes, it doesnt work

-----Original Message-----
Here is an example of the criteria for the field.

Like (IIf(IsNull([Forms]![Form1]![Text0]),"*", [Forms]!
[Form1]![Text0]))

--
Wayne Morgan
Microsoft Access MVP


Hi,

I have a form, holding criteria combo's for a query.
I want to define, that if a user leaves one of them
blank, the it won't effect the query's data,
meaning,
it
would be as if he entered like "*" to the criteria
row.

How can i define this?
thanks


.



.



.


.
 
Back
Top