pjm
05-07-2005, 08:24 AM
Hi,
I have two access tables acting like a product catalog (one table for the categories and other for the products) Something like this:
Table1:
CatID, CatName
============
1, Cat1
2, Cat2
3, Cat3
Table2:
ProdID, CatID2, ProdCat
==================
1, 2, 1
2, 3
3, 3
In a form (to add a new product to Table2) I need to populate a dropdown with the CatName. So far so good. Now, I will going to have special categories with just one product. When that happens the ProdCat value is '1' (that means that the category is not going to have any more products). So when populating the dropdown with CatName in those cases where ProdCat is equal to '1' I don't want the corresponding category being showed in the dropdown. How to do this? I have the following code but I know it's not correct and maybe I'm completely out of track:
<select name="CatID2">
<% While (NOT rsCat.EOF)
While (NOT rsProd.EOF)
if rsProd("ProdCat") = 1 then %>
<option value="<%=(rsCat("CatID"))%>"><%=(rsCat("CatName"))%></option>
<% else
end if
rsProd.MoveNext()
Wend
rsCat.MoveNext()
Wend %>
</select>
I have two access tables acting like a product catalog (one table for the categories and other for the products) Something like this:
Table1:
CatID, CatName
============
1, Cat1
2, Cat2
3, Cat3
Table2:
ProdID, CatID2, ProdCat
==================
1, 2, 1
2, 3
3, 3
In a form (to add a new product to Table2) I need to populate a dropdown with the CatName. So far so good. Now, I will going to have special categories with just one product. When that happens the ProdCat value is '1' (that means that the category is not going to have any more products). So when populating the dropdown with CatName in those cases where ProdCat is equal to '1' I don't want the corresponding category being showed in the dropdown. How to do this? I have the following code but I know it's not correct and maybe I'm completely out of track:
<select name="CatID2">
<% While (NOT rsCat.EOF)
While (NOT rsProd.EOF)
if rsProd("ProdCat") = 1 then %>
<option value="<%=(rsCat("CatID"))%>"><%=(rsCat("CatName"))%></option>
<% else
end if
rsProd.MoveNext()
Wend
rsCat.MoveNext()
Wend %>
</select>