Cascading comboboxes

jadeIT

Systems Analyst
Local time
Today, 21:18
Joined
Jul 16, 2002
Messages
50
I have two combo boxes on a form. one is products, the other is colours.

products looks up all the products from the products table

colours looks up all the colours that are related the the selected product.

I set the row source for colour like this:

SELECT colours.colourID, colours.colourName FROM colours WHERE (((colours.productID)=[product]));

And put

cboColour.requery

in the code for cboColour_SetFocus

So the user should be able to select a product, and then one of the colours for the product. I have a form in datasheet view to do this....

The combo boxes lookup and store the values correctly, however, the colour field on the form appears blank, and only shows the selected colour value on the record you have the cursor on. i attached a picture which shows the problem. you can see that the colour field appears on the record the cursor is on, but all the other fields for the other records are blank, even tho there is a value for the field stored.


any help would be great, as this problem is pretty much the only thing i need fixed and then i can finish the damn thing.

james
 
oh yeah, heres the picture
 

Attachments

  • untitled.gif
    untitled.gif
    19.5 KB · Views: 278
a way...?

well its a form, just with the default view as datasheet, sorry.

i think i found a way to do it tho, by having the colour combo box type as value list, and then inserting the values from a related table in code (.additem) it seems to solve the problem.
 
Here's a sample that shows you how to do cascading combos in datasheet view. It requires a separate field to show the colour, with the colour id field being the one that shows in the combo box.
 

Attachments

ah i see, it turns out i would have had to set the 'limit to list' value to false...
 

Users who are viewing this thread

Back
Top Bottom