473,411 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Updating Mutilple Fields with a Single Combo box

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
3 22216
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
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
You might want to also read up on Normalization.
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Prakash Wadhwani | last post by:
In a small Contacts Database, I have 6 Boolean(Yes/No) Fields so that 6 individuals in the company can maintain their own private mailing list. The names of the fields are as follows: Commander...
2
by: Cro | last post by:
Dear Access Developers, I am developing a form with 'default view' set to "continuous forms". I am suffering with a problem I can't yet see a solution too. Each record has many fields. Two...
6
by: cyoung311 | last post by:
I'm trying to do an automatic update of one table from another through a form. Basically, when a selection is made for an item, in this case a particular workshop, I want to get the associated...
5
by: J. Yuan | last post by:
Hi, I am working on a checkout/inventory system. How can I make a button that when pressed, would update the previous fields transaction number to a table (for example, -3 printers, so that...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
3
by: fstenoughsnoopy | last post by:
Ok the complete story. I have a Contact Table, Query and Form, that are used to input and store the contact info for customers. They have FirstName, LastName and Address as the primary key...
9
by: cybervegan | last post by:
Hi, First, the background info: I have a parent form, New_Jobcard that contains a combo-box to select Cust_ID. The combobox shows customers sorted by name and address, like this: Cust_ID V ...
9
by: Marianne160 | last post by:
Hi, I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
1
by: Eric IsWhoIAm | last post by:
I have three tables: Courses (Key is Autonumber Course Number, also have Text Course Name); Instructors (similar fields); and Courses and Instructors (have a combination of the four fields). ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.