General discussion

Locked

Access 2000 Form Question

By dakota99 ·
I am using Access 2000. I am trying to get a form field to auto generate a value based on what is entered in the field before it. For example if field 1 is employee_id and field 2 is employee_name, I am looking to have the employee_name field filledin according to the matching employee_id that is entered by the form user. Is this possible?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Access 2000 Form Question

by Karpi In reply to Access 2000 Form Question

Hi,

yes it is possible.

Use the onUpdate-Event of employee_id an place the following code:

If Not IsNull(Me.employee_id) Then
a = DLookup("MyDBFieldEmployee_name", "MyEmployeeTable", "MyDBEmployeeidField=" & Me.employee_id)
End If

Pleas replace the My... with the according Field/Tablenames from your System

HTH
Karpi
<fluctuat nec mergitur>

Collapse -

Access 2000 Form Question

by dakota99 In reply to Access 2000 Form Question

Thanks for your help. I am having a little trouble following your example....

In your example: What does Me.employee_id stand for?
Also, there is no on update. The closest thin I found was before or after update. I tried the code in after updatewithout success.

I am a little confused...Please Help....

Collapse -

Access 2000 Form Question

by Karpi In reply to Access 2000 Form Question

OK,

the event is really "After Update". Sorry!

Here is some clarification:

MyDBFieldEmployee_name => is the Tablefield that holds the Name of the employee.

MyEmployeeTable => is the Name of the table that holds the Employee-Information.
MyDBEmployeeidField => is the tablefield that holds the employeeid

Me.employee_id => is the formfield that holds the user-entered employee-id

a => is the formfield that holds the name of the employee

This statement simply means Lookup a field (MyDBFieldEmployee_name) in a table (MyEmployeeTable) with a restriction (in the row where the employee_id is equal to the user-entered value from employee_id)

HTH
Karpi
<fluctuat nec mergitur>

Collapse -

Access 2000 Form Question

by dakota99 In reply to Access 2000 Form Question

The question was auto-closed by TechRepublic

Collapse -

Access 2000 Form Question

by phingers In reply to Access 2000 Form Question

2 tables - one for employee data and one for the employee ID. ID is the primary key, relationship between them of one-to-many on employee ID. Set your form to be based on a query that pulls the employee data and the ID from the employees table, and the employee name from the ID table. Base your form on the query, now if you enter an employee ID the form should get the name from the right place automatically? hope this helps!

Collapse -

Access 2000 Form Question

by dakota99 In reply to Access 2000 Form Question

The question was auto-closed by TechRepublic

Collapse -

Access 2000 Form Question

by dakota99 In reply to Access 2000 Form Question

This question was auto closed due to inactivity

Back to Software Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums