subform with combo selection

ylp

Registered User.
Local time
Today, 12:28
Joined
Mar 25, 2010
Messages
42
Hi,

I have a subform which displays mutiple records based on main forms date time parameters, now I need to add a combo with values 2,3. if user select 2, then a textbox value(databound) in the subform need to *2 and display results in a label, otherwise *3.

The problem is my combo event can do the calculation, but all records results are same. please help.


Thanks
 
Last edited:
Ummm ...

In the AfterUpdate event of the combo box, use something like the following ....

Code:
Me.lblLabelName.Caption = Me.cmbComboBoxName * Me.txtControlWithData
That will update the label. Now, your label isn't a bound control so 'all records will still be the same'.

HTH,
-dK
 
You would also need an IIF() statement and you would need to test for nulls, IsNull() - or use Len().

This would also depend upon where the label is, so proper referencing would be required.
 
Aye, true that ... I didn't do any data validation for what I offered.

-dK
 
Thanks for all your reply!

And sorry for the unclear statements!

The subform has one databound textbox, one new added combo with values 2 and 3, and one non-databound label or textbox used to display calculation results. Say, I have 3 records in the subform, when user pick 2 from the combo, all the other non-databound textbox will display same results, and the other records' combo will be selected 2 automatically.
Thanks.
 
So - are you using continuous forms or datasheet view for the subform?

-dK
 
Hi,dk,

Thanks so much for you reply.

the subform is a datasheet format, I know the continous subform can do that, but how to do that in datasheet format?
 
I like datasheets better ... if a continuous subform then I probably wouldn't be able to assist because IMO they can be quirky - but then again, I am not good with them --- which by circular logic and fallacy is why I like datasheets better. :p

I would think all the fields say they same thing is either because they are all bound to the same data source, or, the combo box reference isn't correct.

Suppose your combo box has multiple columns? If the first column was used as an operator for the math and you wanted to assign the other columns to other controls it would look something like ...

Code:
Me.txtControlToBeAssigned1 = Me.cmbComboBox.Column(1)
Me.txtControlToBeAssigned2 = Me.cmbComboBox.Column(2)
Me.txtControlToBeAssigned3 = Me.cmbComboBox.Column(3)
...

If this doesn't get it - strip down the database and post a sample.

Thanks,
-dK
 

Users who are viewing this thread

Back
Top Bottom