Form control value based on combo box

  • Thread starter Thread starter Jaime
  • Start date Start date
J

Jaime

I have the following:

Form: frmAccountBalance
Table: tblAccountBalance
fields in this table are account, description, Jan, Feb, Mar, etc

I am creating a form where I want a combo box value determine which field is
displayed in the form. I have account, description, and balance in the form
as controls. If the combo box value is Jan, I want to be able to display the
balance for that table field. Also, when the combo box is changed to Feb, I
would like to see the control change the values to display Feb balances.

Please help. Thanks

Jaime
 
Jaime said:
I have the following:

Form: frmAccountBalance
Table: tblAccountBalance
fields in this table are account, description, Jan, Feb, Mar, etc

I am creating a form where I want a combo box value determine which field is
displayed in the form. I have account, description, and balance in the form
as controls. If the combo box value is Jan, I want to be able to display the
balance for that table field. Also, when the combo box is changed to Feb, I
would like to see the control change the values to display Feb balances.


Use the combo box's AfterUpdate event procedure to set the
text box's value:

Me.textbox = Me(Me.combobox)
 
Thanks for the quick response. It doesn't seem to work correclty. The table
has 2000 accounts and each have balances for Jan, Feb, and Mar. The form
lists all of the account with zero even though there are amounts in the table.
By control "Balance" control is unbound. What else am I missing?
 
Jaime said:
Thanks for the quick response. It doesn't seem to work correclty. The table
has 2000 accounts and each have balances for Jan, Feb, and Mar. The form
lists all of the account with zero even though there are amounts in the table.
By control "Balance" control is unbound. What else am I missing?


Does "form lists all of the account" mean that it a
continuous form? If so, an unbound text box will not work.
However, you can bind the text box to the field named by the
combo box:
Me.textbox.ControlSource = Me.combobox
which should also work in any situation. If you do not want
users to modify the value, set the text box's Locked
property.

Double check that the combo box's bound column is the field
name the user selects.
 
Back
Top