By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,784 Members | 1,188 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,784 IT Pros & Developers. It's quick & easy.

Populate text boxes with combo box selection

P: n/a
I need to populate text boxes for instance with employee information
using their unique employee works number selected from a combo box.
Can anyone help, I am told thru visual basic this can be achieved.
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
gj
godber wrote:
I need to populate text boxes for instance with employee information
using their unique employee works number selected from a combo box.
Can anyone help, I am told thru visual basic this can be achieved.

You can do it without VBA.

Add extra columns to the combo box
Set the width of the columns to 0 if you want to hide them
In the text bnoxes you want to show the related employee data just refer
to the column:
cmb_empid.column(2)

Even if the combo box hides the extra coilumns you can refer to them
from another control.
ANother way to do this is to have a subform for the employee data and
link the Parent/Child based on the Employee ID selected in the COmbo
box. This option may be better if the information may be required to be
updated on this form.

Have fun
GJ
Nov 13 '05 #2

P: n/a
mi***********@ntlworld.com (godber) wrote in message news:<1f**************************@posting.google. com>...
I need to populate text boxes for instance with employee information
using their unique employee works number selected from a combo box.
Can anyone help, I am told thru visual basic this can be achieved.


Umm... this is vague. Yes, you can. There are lots of ways.
1. using DLookup (yech!)
2. Using recordsets
3. having multiple columns in your combobox and referencing those
4. ... (insert your own here)
Nov 13 '05 #3

P: n/a
In the properties part of your combobox create a recordsource - which
is usually a set query.

The order of columns of your query is the same as your combobox.

Put all the info into your query for the combobox that you want to
display in the text boxes.

Create the text boxes. Set the control source of your text boxes to
the corresponding column in your combobox - ie TYPE THIS: =
me.comboboxname.column(3)

Remember the first column is 0, not 1.

When you select an item in the combo its column data will then appear
in the text box.

Remember you can hide the columns you do not want to display by
chnaging the column width.

Lincoln
Sydney Australia


mi***********@ntlworld.com (godber) wrote in message news:<1f**************************@posting.google. com>...
I need to populate text boxes for instance with employee information
using their unique employee works number selected from a combo box.
Can anyone help, I am told thru visual basic this can be achieved.

Nov 13 '05 #4

P: n/a
Create a form with all of the desired data fields including the employee's
primary key. Now create an unbound combo box for employee selection. Make
sure that the combo box's underlying query includes the Primary Key for the
'employee works number' plus whatever other fields are needed to correctly
identify the particular employee to be selected, such as LastName,
FirstName. Name the combo box "EmployeeSelect". Enter the following code in
the AfterUpdate event for the combo box:

DoCmd.GoToControl "EmployeeWorks Number" (or whatever is the actual name of
the primary key field. Include quotes)
DoCmd.FindRecord Me![EmployeeSelect]

That's all. When the employee is selected from the combo box the form will
populate with whatever fields are in the employee's record having that
primary key.

Con Giacomini

"godber" <mi***********@ntlworld.com> wrote in message
news:1f**************************@posting.google.c om...
I need to populate text boxes for instance with employee information
using their unique employee works number selected from a combo box.
Can anyone help, I am told thru visual basic this can be achieved.

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.