Combo box in Form

G

Guest

Hello all,

I would like to select the Student ID from ComboBox (Student Id from
Students table) on the Form. The, all the information of that Student ID
automatically appear on form as well (such as Address, DOB, FirstName,
LastName . All these fields also from table Students). How can I do it on
Form.

Here, my goal is not to use Navigation Buttons on Form.

Please show me a solution ! Thanks a lot!
 
D

Douglas J. Steele

Ensure that the RowSource for the combobox includes all of the pieces of
information in which you're interested (you can set the widths to 0 if you
don't want to display them in the combo box).

In the combo box's AfterUpdate event, put code to copy the various columns
of the selected item into text boxes on your form.

Private Sub MyCombo_AfterUpdate()

Me.Text1 = Me.MyCombo.Column(1)
Me.Text2 = Me.MyCombo.Column(2)

End Sub

Note that the Column collection starts counting at 0. The code above would
put the value from the 2nd column of the row source into Text1, and the
value from the 3rd column into Text2.
 
G

Guest

Hi Doug,

Thanks for your AfterUpdate information. I got the answer for my problems:)

Thanks alot again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top