Autofill from a Combo Box

G

Guest

I want to be able to choose a name from a list on a from and then autofill
the rest of the informations on the form. Example; I have a employee form
that I want to choose a name from a combo box. Once I have selected the
person I want the rest of the information regarding that employee to autofill
the form. Can this be done in the same form? Do I have to create a sub-form
with the other information?
 
G

Guest

Include all the fields that you want to display in the form in the row source
of the list box
Select Employee , Field2, Field3, Field4 From TableName

On the after update event of the list/combo box, you can write the code
Me.Field1 = Me.ListBoxName.Column(1)
Me.Field2 = Me.ListBoxName.Column(2)
Me.Field3 = Me.ListBoxName.Column(3)

Or
You can write in the ControlSource of each field
In the field1
=[ListBoxName].Column(1)

In the field2
=[Phone].Column(2)

The column number of the list box start with 0 and up
 

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