Combobox values

CosmaL

Registered User.
Local time
Today, 10:47
Joined
Jan 14, 2010
Messages
94
Hello everybody!


I've got a form called ingredients (fields: name, code, date)


In another form which contains a subform as a datasheet, i've got a combobox which source is the name field of ingredients.


Is it possible, when the user selects an ingredient in the combo, when he adds a new record-in the subform- to not allow him to select the already inserted ingredient?



Thank you in advance!!!




Best regards,
Costas
 
There are at least two ways to do this. I generally prefer to modify the query rather than write code.

The RowSource for the combo needs to be a query that uses a left join.

Select IName, ICode, UseDate
From tblIngredients Left Join tblIDetails On tblIngredients.IngredientID = tblIDetails.IngredientID
Where tblIDetails.IngredientID Is Null;

I took some liberties and added a unique ID and assumed it is the primary key of the ingredients table. I also modified all your column names because they are all reserved words and will cause problems with writing code if you are not careful.
 

Users who are viewing this thread

Back
Top Bottom