View Full Version : Passing the value to 3 fields based on the selection in a combo box?


Tina Brev
10-26-2000, 07:07 PM
Help anyone before I lose my hair.
1 combo box with 5 values to choose from.
These 5 values consist of 5 groups of functions. Based on the function selected on this combo box,how can i automatically fill in the values in 3 other fields?
I tried to make 5 different forms but how do I tell Access that if the value in this combo box is this, then go to this group of records to extract the information.

Forever grateful!

Former
10-27-2000, 12:48 AM
You will need to write some code... The code below sets all the text boxes to display the key value of the combo box.

It's very basic....

Private Sub cboCombo_AfterUpdate()
On Error GoTo Err_cboCombo_AfterUpdate

Me.txtTextBox1.Value = Me.cboCombo.Value
Me.txtTextBox2.Value = Me.cboCombo.Value
Me.txtTextBox3.Value = Me.cboCombo.Value

Exit Sub
Err_cboCombo_AfterUpdate:
DisplayError Err, "cboCombo_AfterUpdate"
Exit Sub
End Sub

You don't say whether you know precisely want you want in the 3 text boxes, or whether you would like to actually find values from the database dependant on the choice in the combo. If you give us a bit more description I'm sure that someone will be able to give you the definitive answer.