Help with DLookup

L

lucky33

I have a DLookup function on my form and it works by finding the
information once I exit and then re-enter the form, it does not bring
in the information as soon as I enter the information in the lookup
field.

=DLookUp("[Employee Name]","[Employee Information]","[Employee
ID]=forms![Timesheet Entry]![Employee ID]")


Does anybody know why it is not updating immediately?


All help is greatly appreciated
 
K

Ken Snell \(MVP\)

Where are you using this expression -- as the control source of a textbox?
More details about the form's design and how you're using the form,
please...
 
L

lucky33

The person that wants this database wants the information about the
employee name pulled into the entry form once they key the employee
ID into the employee ID field.

Is there a better way of pulling this information from another field?
 
J

John W. Vinson

The person that wants this database wants the information about the
employee name pulled into the entry form once they key the employee
ID into the employee ID field.

Is there a better way of pulling this information from another field?

Yes.

To display the name *ON THE FORM* (without storing it redundantly in the
table), include the name in an Employee combo box's RowSource query. For
instance, you could use a RowSource

SELECT EmployeeID, LastName & ", " & FirstName AS EmployeeName
FROM Employees
ORDER BY LastName, FirstName;

Set the combo's Column Count to 2, its Bound Column to 1, and its Control
Source to Employee ID. Set the ColumnWidths property of the combo to

0;1.5

This will *show* the employee name (in the combo box), while storing
If the employee ID's are meaningful and the user will routinely be entering
them directly, ORDER BY EmployeeID instead, and make both columns visible by
using a nonzero width for the first column. You can then put a textbox on the
form with a control source such as

=cboEmployee.Column(1)

to display the second column (the name; the Column property is 0 based) in the
textbox, while the ID is displayed in the combo.


John W. Vinson [MVP]
 

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