How do I put additional information in field.

trythis

Registered User.
Local time
Yesterday, 21:20
Joined
Jul 27, 2009
Messages
67
I have a table with
employeeid
employeename
positionid

then I have another table
Positionid
positionDescription

How can I select the emplyee's name and have it file in the description of the position?

so I select john doe from the drop down list and it enters the positiondescription automatically.

I think I need to change my tables but i am not sure.

I would need drop down that does two things
puts the employeeid in field
puts the positionid in field

Thanks,
Tina
 
I have a table with
employeeid
employeename
positionid

then I have another table
Positionid
positionDescription

How can I select the emplyee's name and have it file in the description of the position?

so I select john doe from the drop down list and it enters the positiondescription automatically.

I think I need to change my tables but i am not sure.

I would need drop down that does two things
puts the employeeid in field
puts the positionid in field

Thanks,
Tina

Your tables look fine. Create a query that joins them together using Positionid as a Primary Key for the Positions Table, and as a Foreign Key for the Employee Table. The SQL would look something like this:
Code:
    SELECT tblEmployees.EmployeeName, tblPositions.positionDescription
    FROM tblEmployees INNER JOIN tblPositions
    ON tblEmployees.Positionid=tblPositions.Positionid
 
Or use the Wizard for combobox creation, based on the EmployeeTable, with the fields, from left to right, being EmployeeName and EmployeeID. Create a textbox (call it txtDescription) to hold the description. Then use this code in the combobox AfterUpdate event.
If PositionID is a Number Datatype:
Code:
Private Sub EmployeeComboBox_AfterUpdate()
 Me.txtDescription = DLookup("PositionDescription", "PositionTable", "[PositionID] = " & Me.EmployeeComboBox.Column(1))
End Sub
If PositionID is a Text Datatype:
Code:
Private Sub EmployeeComboBox_AfterUpdate()
 Me.txtDescription = DLookup("PositionDescription", "PositionTable", "[PositionID] = '" & Me.EmployeeComboBox.Column(1) & "'")
End Sub
 

Users who are viewing this thread

Back
Top Bottom