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

Updating Mutilple Fields with a Single Combo box

P: n/a
Hello All,
I was wondering if it is at all possible to have a single combo box
update multiple fields in a single record. For example I have created
an Employee Info form, and in that form there's a combo box (called
"DirectorName") that contains the Directors Info that is connected to
a table called "tblDirector" that has the Director's First Name, Last
Name, and Director ID. Now all three fields appear in the one combo
box (which the user wants), when the user click a button to save the
changes I want it to take the content selected in the "DirectorName"
combo box and have it update the exact same field names in the
"EmployeeInfo" table. If anyone can let me know how I can go about
doing this, or if it is at all possible, I'd very like to know how.
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
If your form is based on the table your user is working on (meaning when
you navigate to a record the data from that record shows up in the
respective textfields) and you have textfields in your table for the
Director data, you can use the OnClick Event of the combobox to populate
those fields. Goto the design view of your form, right click on the
combobox and bring up its property sheet (the bottom selection of the
dropdown menu list when you right click on the combobox). In the
property sheet scroll down to the OnClick event, click inside that field
and the click on the button to the right with the elipses (...). Select
Code Builder. This puts you in the form's code module in the OnClick
Event of the combobox. Here you can add code like this:

Private Sub combo1_OnClick()
txtDirectorID = combo1.Column(0)
txtDirectorFirstName = combo1.Column(1)
txtDirectorLastName = combo1.Column(2)
End Sub

Here it is assumed that ID is the first column in your combobox
(column(0)), then column(1), (2).

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2

P: n/a
You can use the combo box Column property to access it's column data. For example, [ComboBoxName].Column(0) would return the
first column in the currently selected row of combo box [ComboBoxName]. [ComboBoxName].Column(1) would return the second
column on the currently selected row, which you could assign a field to equal this value. You can specify 2 numbers for this
property, which the second number would then be the row index to return a column that is not the currently selected row, but
this defaults to the ListIndex value so that it will be selecting from the current row if you don't specify.

FieldA = [ComboBoxName].Column(1)
FieldB = [ComboBoxName].Column(2)

More information on the Column property can be found in the help files.

On 23 Sep 2003 07:35:16 -0700, bo****@ottawa.com (Bobbak) wrote:
Hello All,
I was wondering if it is at all possible to have a single combo box
update multiple fields in a single record. For example I have created
an Employee Info form, and in that form there's a combo box (called
"DirectorName") that contains the Directors Info that is connected to
a table called "tblDirector" that has the Director's First Name, Last
Name, and Director ID. Now all three fields appear in the one combo
box (which the user wants), when the user click a button to save the
changes I want it to take the content selected in the "DirectorName"
combo box and have it update the exact same field names in the
"EmployeeInfo" table. If anyone can let me know how I can go about
doing this, or if it is at all possible, I'd very like to know how.


Jeremiah Ellison
Ellison Enterprises - Your One Stop IT Experts
Nov 12 '05 #3

P: n/a
You might want to also read up on Normalization.
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.