combo box in sub form.... .:(

millarjeremy

New member
Local time
Tomorrow, 06:12
Joined
May 9, 2013
Messages
9
hello ALL, I thank you in advance and apologies for my basic questions.

so here goes and hopefully I am clear.

I have in my main form a order section, and a sub form which bring up the details of that order... got that working a treat!!! Now I want to get a bit more tricky.

In the main section if you choose a category froma cbo box, let's call it Fruit Type: Apple

In the sub form in the first column I would like it to only list the apple sorts, Granny, Red, Green. At present it shows all the fruit sorts?

I do have a table for fruit types and another for fruit sorts. and fruittypeID is a reference back.

The sub form is based on a qry, which includes the fruit sort and the order qty. store location etc etc, not sure if this is making it hard for me.

Once again thank you for your assistance that you my give.
 
Can your order contain more than one fruit type? If so then you need a more complex solution otherwise when you change the fruit type the 'other' fruits will seem to disappear from the subform - basically you need to put your fruit type combo, not on the main form, but on the subform.

To ensure it repeats for each new line, in the after update event of the fruittypecombo on your subform put
Code:
FruitTypeCombo.Default=FruitTypeCombo
Assuming you have done this then also in the after update event of the fruittypecombo you have some code along the following lines
Code:
FruitCombo.RowSource="SELECT ID, FruitName From FruitTable WHERE FruitType=" & FruitTypeCombo

If you do only have one fruittype per order then in the fruittypecombo on the main form put
Code:
MySubform.Form.FruitCombo.RowSource="SELECT ID, FruitName From FruitTable WHERE FruitType=" & FruitTypeCombo
 
that is what I needed..... nice work and you
 

Users who are viewing this thread

Back
Top Bottom