0

I have two tables like

Staff Table
............
Staff ID
Staff Name
Age
...and more

Staff Salary Table
..................
Staff ID
Staff Name
basic Salary
...and more

Now I have created the Staff Salary form in which I got the staff ID from the staff table using the lookup wizard query in the Staff ID field of the Staff Salary Table
SELECT [Staff Table].[Staff ID] FROM [Staff Table];

but I need one more

When The staff ID was selected from the drop down list, I need the relevant staff name (from the Staff table) also be displayed in the staff salary from .

Can you please let me know how to do this..

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by adam_k
0

You need to change the datasource from your form to a join like this:

select [Staff Salary].[Staff ID], [Staff Salary].[Basic Salary], [Staff Table].[Staff Name] from [Staff Salary] Left Join [Staff Table] 
on [Staff Salary].[Staff ID] = [Staff Table].[Staff ID]

PS: You shouldn't have a Staff Name in the Staff Salary table. You can get it with a join like above when you need it and you are saving yourself the trouble of maintenance (updating it's value whenever the value of Staff Name in Staff Table changes).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.