query returns null..please help...

S

shsh_shah

Hi, I have two tables and following is there datatype
Products Table:
P.ID-AutoNumber as datatype
ProductName-Text as datatype
ProductType-Text as datatype
Price- number as datatype
Packing-number as datatype

Packing Table:

PackingID=Autonumber as datatype
PackingName - Text as datatype


and i am bit confused as how the query will be to get the price of the
product based on above tables bec when i run

SELECT distinct Products.CPrice
FROM Packing INNER JOIN Products ON Packing.PackingID=Products.Packing WHERE
(([WHERE Products].[ProductName]="@prod" And [WHERE Packing].[PackingName]
="@pac"));

I get nothing in result..any help please..I really need this somehow to solve.
..please advise
 
K

Ken Snell MVP

I'm not completely understanding what you're doing, but perhaps this query
will work:

SELECT distinct Products.CPrice
FROM Packing INNER JOIN Products ON Packing.PackingID=Products.Packing WHERE
(([Products].[ProductName]="@prod" And [Packing].[PackingName]
="@pac"));
 
S

shsh_shah via AccessMonster.com

Ken said:
I'm not completely understanding what you're doing, but perhaps this query
will work:

SELECT distinct Products.CPrice
FROM Packing INNER JOIN Products ON Packing.PackingID=Products.Packing WHERE
(([Products].[ProductName]="@prod" And [Packing].[PackingName]
="@pac"));

Hi Ken,

The above query did not work and display empty price table...ok to give you
better shape of what i am asking is...As i have mentioned i have 2 tables...
And i want to retrieve value of Price which is in Products table..

So i need a query when i run it..it should ask me ProductName and PackingName
and then it display Price of the Product.

Did you get it i hope so?

Thanks,
Regards,
 
K

Ken Snell MVP

Ok, try this:

SELECT distinct Products.CPrice
FROM Packing INNER JOIN Products ON Packing.PackingID=Products.Packing WHERE
[Products].[ProductName]=[Enter product name:] And [Packing].[PackingName]
=[Enter packing name:];

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/



shsh_shah via AccessMonster.com said:
Ken said:
I'm not completely understanding what you're doing, but perhaps this query
will work:

SELECT distinct Products.CPrice
FROM Packing INNER JOIN Products ON Packing.PackingID=Products.Packing
WHERE
(([Products].[ProductName]="@prod" And [Packing].[PackingName]
="@pac"));

Hi Ken,

The above query did not work and display empty price table...ok to give
you
better shape of what i am asking is...As i have mentioned i have 2
tables...
And i want to retrieve value of Price which is in Products table..

So i need a query when i run it..it should ask me ProductName and
PackingName
and then it display Price of the Product.

Did you get it i hope so?

Thanks,
Regards,
 
S

shsh_shah via AccessMonster.com

Thanks Ken, it worked awesome..but what is mean by [Enter Product Name] what
"enter" shows here?
 
K

Ken Snell MVP

[Enter Product Name] is a parameter.... it "looks" like a field, but it's a
"field" that is not in any of the data tables. So, ACCESS asks you to
provide the value for it.
 

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

Top