How do I populate a field in a form based on a value in a previou.

J

Jim B.

I work in property management, and I'm trying to create a "call log" form to
track tenant calls for repairs, maintenance, etc. I have a drop down list in
a field that I have set up to select the apartment address from a table
called "apartments". I have a separate table for the apartment addresses
because those generally don't change. I have a related table for the tenant
information, because tenants do change from time to time. The "tenant" table
is related to the "apartment" table on an "address" field that exists in both
tables.

Ideally, when I receive a call from a tenant, on my "call log" form I can
select their aparment address from the drop down in the "address" field, and
that will in turn populate the phone number for that particular tenant in
that particular apartment in the phone number field on the form.

Does that make sense to any one?

Jim B.
 
K

Ki Yi [MS]

Hello,

There are several ways of doing this but I suggest using the DLookup
function. For example,
add the code into the "after update" event of the combo box:

Me![name of the field on the form you are trying to populate] =
DLookup("[LastName]", "Employees", "[EmployeeID] = " & _
Forms![FormName]![ControlName])

For more detail information and examples of DLookup usage, check out
following knowledge base article:

Description of DLookup() usage, examples, and troubleshooting in Access
WGID:147
ID: 208786.KB.EN-US
http://support.microsoft.com/default.aspx?scid=kb;EN-US;208786

Regards,

Ki Yi
Microsoft Support

This posting is provided AS IS with no warranties, and confers no rights.
 

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