Monika wrote:
Quote:
Hi,
I have created a Training database. Employees need to enter their
training each month. I have created three tables: Employee, Unit, and
training. (We have 3 units, I created this for report purpose, so I
can report each unit did what trainings). Now, problem is when
employees want to enter their training they shouldn't type their
Employee ID and Unit ID, it should pop up automatically based on their
name they choose from combobox. but it doesn't. I don't know how to
solve this problem. Please help. Thank you. |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I don't know which table each employee's Unit ID is in. I'll assume
it's in Employees table.
Set the Employee ID ComboBox's properties to this:
Column Count: 3
Column Widths: 0";0";2"
Bound Column: 1
Limit To List: Yes
Row Source Type: Table/Query
Row Source: SELECT EmployeeID, UnitID, EmployeeName FROM Employees ORDER
by EmployeeName
In the ComboBox's AfterUpdate event procedure put this (EmployeeID is
the name of the ComboBox - change as needed):
Private Sub EmployeeID_AfterUpdate()
If Not IsNull(Me!EmployeeID) Then
' Push the UnitID into the UnitID control.
' UnitID is in the 2nd column of the ComboBox's RowSource.
' ComboBox columns are count-zero.
Me!UnitID = Me!EmployeeID.Column(1)
End If
End Sub
HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBSm/YV4echKqOuFEgEQI1SwCguWH/KPoH8hqPTlWiK4H9sLMba+0An23y
Y7REr+RU8j6WaqDMVaXewOUj
=WKX/
-----END PGP SIGNATURE-----