Elementary Form Question (1 Viewer)

DeLaMartre

Registered User.
Local time
Today, 03:42
Joined
Sep 22, 2002
Messages
12
Sorry for this elementary question, but I am an Excel guy, and a bit new to Access:

I have a simple database with two tables and forms. On the Main Form, I have one field (NAME) in which you can pick an employee's name from a combobox (this comes from a simple Employee Table).

Depending on the employee chosen in the field above, I want the second field (UNITNUMBER: a textbox) to populate with the Unit the employee belongs to (this information is in the simple Employee Table).

The resulting Unit # then goes into the Main Table with the Employee that was chosen.

I hope this is explained adequately.

Any help will be greatly appreciated!
 

pottera

Registered User.
Local time
Today, 20:42
Joined
Sep 3, 2002
Messages
236
Bob, Set up your combo box as a 'Table/Query' with rowsource like 'SELECT EmployeeNum, EmployeeName, EmployeeUnit FROM tblEmployees".

have the following code executed by the After Update property of the Combo Box -

Sub ComboBoxName_AfterUpdate()
Me.UNITNUMBER = Me.ComboBoxName.Column(2)
End Sub
 

R. Hicks

AWF VIP
Local time
Today, 05:43
Joined
Dec 23, 1999
Messages
619
There is no need to use the After Update event to popuate the textbox.
You only need to use the following as the "Control Source" for the txtbox where the info is to be displayed:

= Me.ComboBoxName.Column(1)

This information will not .. and should not be saved to the table. It should be used for viewing purposes on the form only.

HTH
RDH
 

DeLaMartre

Registered User.
Local time
Today, 03:42
Joined
Sep 22, 2002
Messages
12
Thanks very, very much Peter, Ricky, and Rich!

Your fine suggestions have solved my problem, and I am quite grateful. It never ceases to amaze me how there are so many brilliant individuals in this forum who give so selflessly of their time and expertise!

Now, on to other things...

Surf's Up!
 

Users who are viewing this thread

Top Bottom