IIF Problem

R

rita

i have a query that calculate total sold, total purchased and stock status ,
i want to make this query show only items that less than the reorder level i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit, (select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help
 
M

Maurice

aren't you forgetting the second argument for the iif-statement. Now you do
have an argument when it is true but what if it is false?

IIf([InStock]<[ReorderLevel],"OrderNow", "or else?" ))

hth
 
B

BruceM

rita said:
i have a query that calculate total sold, total purchased and stock status
,
i want to make this query show only items that less than the reorder level
i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help

The IIf is lacking "value if false". Try something like:
IIf([InStock]<[ReorderLevel],"OrderNow","OK")
 
R

rita

no, there is no a second argument , its null but the problem with the
criteria <Ordernow> when its written , returns a <enter parameter box> and
not show the result.
is there something wrong

thanks,

Maurice said:
aren't you forgetting the second argument for the iif-statement. Now you do
have an argument when it is true but what if it is false?

IIf([InStock]<[ReorderLevel],"OrderNow", "or else?" ))

hth
--
Maurice Ausum


rita said:
i have a query that calculate total sold, total purchased and stock status ,
i want to make this query show only items that less than the reorder level i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit, (select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help
 
B

BruceM

Karl's suggestion sounds good, and simpler too. The point Maurice was
making is that IIf *requires* the second argument. If you want it to be
blank, use an empty string: ("") instead of "or else?".

rita said:
no, there is no a second argument , its null but the problem with the
criteria <Ordernow> when its written , returns a <enter parameter box>
and
not show the result.
is there something wrong

thanks,

Maurice said:
aren't you forgetting the second argument for the iif-statement. Now you
do
have an argument when it is true but what if it is false?

IIf([InStock]<[ReorderLevel],"OrderNow", "or else?" ))

hth
--
Maurice Ausum


rita said:
i have a query that calculate total sold, total purchased and stock
status ,
i want to make this query show only items that less than the reorder
level i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID)
AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help
 
R

rita

yes , i made this step but there is no changes its written ok beside the
remaining items but i want the query to only dir <OrderNow> items .

thanks

BruceM said:
rita said:
i have a query that calculate total sold, total purchased and stock status
,
i want to make this query show only items that less than the reorder level
i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help

The IIf is lacking "value if false". Try something like:
IIf([InStock]<[ReorderLevel],"OrderNow","OK")
 
R

rita

u understood me , i written ur suggestion but the same issue, < enter
parameter box> , and the same problem their is no result

KARL DEWEY said:
Try changing it to this ---
WHERE [InStock]<[ReorderLevel];

--
KARL DEWEY
Build a little - Test a little


rita said:
i have a query that calculate total sold, total purchased and stock status ,
i want to make this query show only items that less than the reorder level i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit, (select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help
 
K

KARL DEWEY

Try doing your subquery calculations in separate queries then join in final
query.
--
KARL DEWEY
Build a little - Test a little


rita said:
u understood me , i written ur suggestion but the same issue, < enter
parameter box> , and the same problem their is no result

KARL DEWEY said:
Try changing it to this ---
WHERE [InStock]<[ReorderLevel];

--
KARL DEWEY
Build a little - Test a little


rita said:
i have a query that calculate total sold, total purchased and stock status ,
i want to make this query show only items that less than the reorder level i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit, (select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help
 
M

Maurice

Ok, lets take another look at it. Looking at the where clause you've added
the second argument. But how about the following:

-----
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>
----

In the first part of the iif you are also refering to one argument. Besides
that you are defining a column [Status] and in the whereclause of your
statement you are not refering to a criteria field. My guess is that it
should be status="Ordernow"

hth
--
Maurice Ausum


rita said:
yes , i made this step but there is no changes its written ok beside the
remaining items but i want the query to only dir <OrderNow> items .

thanks

BruceM said:
rita said:
i have a query that calculate total sold, total purchased and stock status
,
i want to make this query show only items that less than the reorder level
i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help

The IIf is lacking "value if false". Try something like:
IIf([InStock]<[ReorderLevel],"OrderNow","OK")
 
B

BruceM

I believe the problem may be that an alias cannot be used in a WHERE clause
in the same query. That has been my observation based on experiments, but I
admit I don't all of the details.

You need a second condition in the IIf. It is not "written OK".

If you can get the query to work without the WHERE clause, you can use the
named query (qryProducts) to make another query:

SELECT ProductID, [Product name], Unit, (select
sum(UnitsSold) FROM qryProducts
WHERE ((qryProducts.Status] = "OrderNow"));

Or you can alias the SQL expression within another SQL expression:

SELECT Q1.ProductID, Q1.[Product name], Q1.Unit, (select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow","") AS status
FROM Products AS Q1
WHERE (((Q1.Status] = "OrderNow"));

Maurice said:
Ok, lets take another look at it. Looking at the where clause you've added
the second argument. But how about the following:

-----
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>
----

In the first part of the iif you are also refering to one argument.
Besides
that you are defining a column [Status] and in the whereclause of your
statement you are not refering to a criteria field. My guess is that it
should be status="Ordernow"

hth
--
Maurice Ausum


rita said:
yes , i made this step but there is no changes its written ok beside the
remaining items but i want the query to only dir <OrderNow> items .

thanks

BruceM said:
i have a query that calculate total sold, total purchased and stock
status
,
i want to make this query show only items that less than the reorder
level
i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID =
Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials
where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help

The IIf is lacking "value if false". Try something like:
IIf([InStock]<[ReorderLevel],"OrderNow","OK")
 
R

rita

no, there is no any change , i want to ask a question ,can i set a criteria
to a calculated field ?

Maurice said:
Ok, lets take another look at it. Looking at the where clause you've added
the second argument. But how about the following:

-----
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>
----

In the first part of the iif you are also refering to one argument. Besides
that you are defining a column [Status] and in the whereclause of your
statement you are not refering to a criteria field. My guess is that it
should be status="Ordernow"

hth
--
Maurice Ausum


rita said:
yes , i made this step but there is no changes its written ok beside the
remaining items but i want the query to only dir <OrderNow> items .

thanks

BruceM said:
i have a query that calculate total sold, total purchased and stock status
,
i want to make this query show only items that less than the reorder level
i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help

The IIf is lacking "value if false". Try something like:
IIf([InStock]<[ReorderLevel],"OrderNow","OK")
 
R

rita

thxxxxxxxxxxxxxxxxxxxxxxx BruceM you are realy helpful , your solution
working and i get a perfect result from perfect query you made.
thx BruceM, good day.
BruceM said:
I believe the problem may be that an alias cannot be used in a WHERE clause
in the same query. That has been my observation based on experiments, but I
admit I don't all of the details.

You need a second condition in the IIf. It is not "written OK".

If you can get the query to work without the WHERE clause, you can use the
named query (qryProducts) to make another query:

SELECT ProductID, [Product name], Unit, (select
sum(UnitsSold) FROM qryProducts
WHERE ((qryProducts.Status] = "OrderNow"));

Or you can alias the SQL expression within another SQL expression:

SELECT Q1.ProductID, Q1.[Product name], Q1.Unit, (select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow","") AS status
FROM Products AS Q1
WHERE (((Q1.Status] = "OrderNow"));

Maurice said:
Ok, lets take another look at it. Looking at the where clause you've added
the second argument. But how about the following:

-----
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>
----

In the first part of the iif you are also refering to one argument.
Besides
that you are defining a column [Status] and in the whereclause of your
statement you are not refering to a criteria field. My guess is that it
should be status="Ordernow"

hth
--
Maurice Ausum


rita said:
yes , i made this step but there is no changes its written ok beside the
remaining items but i want the query to only dir <OrderNow> items .

thanks

:

i have a query that calculate total sold, total purchased and stock
status
,
i want to make this query show only items that less than the reorder
level
i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID =
Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials
where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help

The IIf is lacking "value if false". Try something like:
IIf([InStock]<[ReorderLevel],"OrderNow","OK")
 
R

rita

and many thanks for everyone replies to my subject ,

thxxxxxxxxxxxxx all

rita said:
thxxxxxxxxxxxxxxxxxxxxxxx BruceM you are realy helpful , your solution
working and i get a perfect result from perfect query you made.
thx BruceM, good day.
BruceM said:
I believe the problem may be that an alias cannot be used in a WHERE clause
in the same query. That has been my observation based on experiments, but I
admit I don't all of the details.

You need a second condition in the IIf. It is not "written OK".

If you can get the query to work without the WHERE clause, you can use the
named query (qryProducts) to make another query:

SELECT ProductID, [Product name], Unit, (select
sum(UnitsSold) FROM qryProducts
WHERE ((qryProducts.Status] = "OrderNow"));

Or you can alias the SQL expression within another SQL expression:

SELECT Q1.ProductID, Q1.[Product name], Q1.Unit, (select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow","") AS status
FROM Products AS Q1
WHERE (((Q1.Status] = "OrderNow"));

Maurice said:
Ok, lets take another look at it. Looking at the where clause you've added
the second argument. But how about the following:

-----
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>
----

In the first part of the iif you are also refering to one argument.
Besides
that you are defining a column [Status] and in the whereclause of your
statement you are not refering to a criteria field. My guess is that it
should be status="Ordernow"

hth
--
Maurice Ausum


:

yes , i made this step but there is no changes its written ok beside the
remaining items but i want the query to only dir <OrderNow> items .

thanks

:

i have a query that calculate total sold, total purchased and stock
status
,
i want to make this query show only items that less than the reorder
level
i
written
this statment
<SELECT Products.ProductID, Products.[Product name], Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID =
Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials
where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help

The IIf is lacking "value if false". Try something like:
IIf([InStock]<[ReorderLevel],"OrderNow","OK")
 
B

BruceM

Glad to know it worked. I learned something too.

rita said:
thxxxxxxxxxxxxxxxxxxxxxxx BruceM you are realy helpful , your solution
working and i get a perfect result from perfect query you made.
thx BruceM, good day.
BruceM said:
I believe the problem may be that an alias cannot be used in a WHERE
clause
in the same query. That has been my observation based on experiments,
but I
admit I don't all of the details.

You need a second condition in the IIf. It is not "written OK".

If you can get the query to work without the WHERE clause, you can use
the
named query (qryProducts) to make another query:

SELECT ProductID, [Product name], Unit, (select
sum(UnitsSold) FROM qryProducts
WHERE ((qryProducts.Status] = "OrderNow"));

Or you can alias the SQL expression within another SQL expression:

SELECT Q1.ProductID, Q1.[Product name], Q1.Unit, (select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow","") AS status
FROM Products AS Q1
WHERE (((Q1.Status] = "OrderNow"));

Maurice said:
Ok, lets take another look at it. Looking at the where clause you've
added
the second argument. But how about the following:

-----
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>
----

In the first part of the iif you are also refering to one argument.
Besides
that you are defining a column [Status] and in the whereclause of your
statement you are not refering to a criteria field. My guess is that it
should be status="Ordernow"

hth
--
Maurice Ausum


:

yes , i made this step but there is no changes its written ok beside
the
remaining items but i want the query to only dir <OrderNow> items .

thanks

:

i have a query that calculate total sold, total purchased and stock
status
,
i want to make this query show only items that less than the
reorder
level
i
written
this statment
<SELECT Products.ProductID, Products.[Product name],
Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID =
Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials
where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock,
Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help

The IIf is lacking "value if false". Try something like:
IIf([InStock]<[ReorderLevel],"OrderNow","OK")
 
M

Maurice

Good call Bruce ;-)
--
Maurice Ausum


BruceM said:
Glad to know it worked. I learned something too.

rita said:
thxxxxxxxxxxxxxxxxxxxxxxx BruceM you are realy helpful , your solution
working and i get a perfect result from perfect query you made.
thx BruceM, good day.
BruceM said:
I believe the problem may be that an alias cannot be used in a WHERE
clause
in the same query. That has been my observation based on experiments,
but I
admit I don't all of the details.

You need a second condition in the IIf. It is not "written OK".

If you can get the query to work without the WHERE clause, you can use
the
named query (qryProducts) to make another query:

SELECT ProductID, [Product name], Unit, (select
sum(UnitsSold) FROM qryProducts
WHERE ((qryProducts.Status] = "OrderNow"));

Or you can alias the SQL expression within another SQL expression:

SELECT Q1.ProductID, Q1.[Product name], Q1.Unit, (select
sum(UnitsSold) from OrderDetails where ProductID = Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock, Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow","") AS status
FROM Products AS Q1
WHERE (((Q1.Status] = "OrderNow"));

Ok, lets take another look at it. Looking at the where clause you've
added
the second argument. But how about the following:

-----
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>
----

In the first part of the iif you are also refering to one argument.
Besides
that you are defining a column [Status] and in the whereclause of your
statement you are not refering to a criteria field. My guess is that it
should be status="Ordernow"

hth
--
Maurice Ausum


:

yes , i made this step but there is no changes its written ok beside
the
remaining items but i want the query to only dir <OrderNow> items .

thanks

:

i have a query that calculate total sold, total purchased and stock
status
,
i want to make this query show only items that less than the
reorder
level
i
written
this statment
<SELECT Products.ProductID, Products.[Product name],
Products.Unit,
(select
sum(UnitsSold) from OrderDetails where ProductID =
Products.ProductID) AS
TotalSoldStock, (select sum(UnitsPurchased) from SuppliesDetials
where
ProductID = Products.ProductID) AS TotalPurchasedStock,
([TotalPurchasedSTock]-[TotalSoldStock]) AS InStock,
Products.[last
Purchasing price], Products.ReorderLevel,
IIf([InStock]<[ReorderLevel],"OrderNow") AS status
FROM Products
WHERE (((IIf([InStock]<[ReorderLevel],"OrderNow"))="OrderNow"));>

but its returns <enter prameter box> and not showing any result

plzzzzzz help

The IIf is lacking "value if false". Try something like:
IIf([InStock]<[ReorderLevel],"OrderNow","OK")
 

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

Similar Threads

Inventory 0
union query 0
Crosstab subcolumn query/report heading pblm 3
2 crosstabs 1
Calculating Total Hours spend for a product 1
ERROR#3079!!! 0
SQL Troubles. 1
Problems summing qnty of orders between dates 2

Top