sumpen30
Posts: 16
|
| Posted: 08/18/2004, 11:28 PM |
|
I am currently working on a project where I have different products with several sizes. I have created two tables with one for the general info on the product and then the other table has the specifics for each size. The two tables are joined together by PROD_ID so the primary key for the second table is PROD_ID and PROD_SIZE.
The PROD_SIZE gets its values from a third table called SIZE_P. I have inserted all the sizes into the second table using the listbox but what I want to do now is when I show a specific product I want only the sizes that are related to the Product to show up in the Listbox.
I have gotten other dependent listboxes to work for example country-> state and so on. Nevertheless, I need to pass the PROD_ID to the listbox but I can't get it to work. All the sizes in the SIZE_P tables shows up.
Is there something wrong with my SQL coding or something else?
Grateful for help,
_________________
Guldshoppen.se - Gold and Silver Jewlery
http://www.guldshoppen.se
A website entirely created by CCS |
 |
 |
eiden
Posts: 34
|
| Posted: 08/19/2004, 2:32 AM |
|
It could be something wrong with you SQL query.. who knows??
But if wold help if you post it, then we could all take a look ;)
|
 |
 |
sumpen30
Posts: 16
|
| Posted: 08/19/2004, 2:50 AM |
|
Here is my SQL for the Search form
select PROD_SIZE
from product, product_size
where product.PROD_ID = product_size.PROD_ID
and here is the SQL for the Listbox itself
select PROD_SIZE, PROD_SIZE_NAME
from SIZE_P
Maybe I have to stick something in the BeforeShow to get it to work as well. I don't think the PROD_ID that is passed onto this form is picked up correctly.
Thank you
_________________
Guldshoppen.se - Gold and Silver Jewlery
http://www.guldshoppen.se
A website entirely created by CCS |
 |
 |
sumpen30
Posts: 16
|
| Posted: 08/26/2004, 11:28 PM |
|
I finally figured it out and my SQL looks like this. Hopefully it can be useful to someone in the future when you are pondering how to extract specific data for a Listbox.
SELECT product_size.PROD_ID, storlek.size_id, storlek.size_name, product_size.PROD_SIZE
FROM product_size, storlek
WHERE [product_size].[PROD_SIZE] = [storlek].[size_id] AND
product_size.PROD_ID = {PROD_ID};
_________________
Guldshoppen.se - Gold and Silver Jewlery
http://www.guldshoppen.se
A website entirely created by CCS |
 |
 |
|