Filling a Field in Onne Table Based on Another Table

J

J. Trucking

Hello,

I have a table full of employee information (name, address, etc.).
One of the fields in this table is called BankedHours. I have another
table in which I store time sheet entires. What I would like to have
happen is that when the user inputs an entry in the time sheet table,
and enters an employee name, the BankedHours value for that employee
will automatically be inserted into a field in the time sheet entry.
Is this possible with a function such as DLookup? Any advice would be
appreciated.

Thanks,

John
 
T

Tom van Stiphout

On Thu, 20 Mar 2008 23:44:35 -0700 (PDT), "J. Trucking"

Here is an elegant way to do that:
Create a dropdown (let's call it ddlEmployees) to select the
employees. Its RowSource is set to a query that returns 3 columns.
Something like:
select EmployeeID, EmployeeName, BankedHours
from Employees
Set the ColumnWidths to 0;1;0 to hide the first and third column.
In the BankedHours control, set the ControlSource to:
=ddlEmployees.Column(2)
This will automatically refresh when you select another employee from
the ddl.

Btw, BankedHours sounds a lot like a calculated value, and as such has
no business in a good database design. Rather you'd have a query that
can calculate teh BankedHours for all employees.

-Tom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top