ali said:
I have a form with 4 items.
-ID
-Name
-Nationality
-Department
When i change ComboBox (ID)
i want my textboxes to change accordingly to show thier corresponding
Name,
Nationality and Department.
How can this be done using a form.
Please let me know the steps. Thanks a lot exerpt !
There are several ways this might be done, depending on what you want to
accomplish. If the form's purpose is to allow you to edit -- not just
view -- the name, nationality, and department for people whose ID you select
from the combo box, then you would be most likely be using the combo box to
find a record. The combo box wizard will build such a combo box for you, if
you tell it you want a combo box to "find a record on my form". The form,
in this case, would be based on the same table that combo box uses as its
recordsource.
But instead of that, you may just want to use those text boxes to show data
about the person selected in the combo box, without intending to edit that
information. In that case, you can include the extra information as
additional columns in the combo box's rowsource query, and then set up the
text boxes to pull the information right out of the combo box. In this
case, you would set the combo box to the following properties:
Row Source: SELECT ID, Name, Nationality, Department FROM YourTable
(of course, change "YourTable" to the name of your rowsource table)
Column Count: 4
Bound Column: 1
Then set the Control Source properties of your text boxes to:
For the Name text box: =[cboID].[Column](1)
For the Nationality text box: =[cboID].[Column](2)
For the Department text box: =[cboID].[Column](3)
Note that, in the above, I'm using "cboID" as the name of your combo box.
You should use the actual name of your combo box in that position.