Lookup Fields

  • Thread starter Thread starter Ramone
  • Start date Start date
R

Ramone

Hello Everyone,

I was looking for help with the following problem:

I havea table in the first field i enter the agent ID#

I would like the second field to lookup the value from
the first field in seprate table and enter the agents
name. I would prefer not to use a drop down list box.

Thanks for any help
 
Are you trying to do this in a table or on a form? If on a form, you could
simple make the second textbox a calculated textbox. Set its Control Source
to something like

=DLookup("[ContactName]", "[TableName]", "[ContactID]=" & txtContactID)
 
Hello Everyone,

I was looking for help with the following problem:

I havea table in the first field i enter the agent ID#

I would like the second field to lookup the value from
the first field in seprate table and enter the agents
name. I would prefer not to use a drop down list box.

Thanks for any help

Well, you're misunderstanding how relational databases work!

Tables should NOT contain redundant data. If you can uniquely identify
the agent by their ID, then this table should *not* contain the agent
name.

I suspect that you're using table datasheets for data entry. Don't!
Use a Form instead; on the form you can *display* the agent name while
storing only the ID in the table. A combo box on the Form would be the
best solution, but if you prefer to type the ID manually, put a second
textbox on the form; if the ID textbox is named txtAgentID, set the
Control Source property of the second textbox to

=DLookUp("[AgentName]", "[Agents]", "[AgentID] = " & [txtAgentID])
 
Thanks for the help Wayne I'll use a form.
-----Original Message-----
Are you trying to do this in a table or on a form? If on a form, you could
simple make the second textbox a calculated textbox. Set its Control Source
to something like

=DLookup("[ContactName]", "[TableName]", "[ContactID]=" & txtContactID)

--
Wayne Morgan
Microsoft Access MVP


Hello Everyone,

I was looking for help with the following problem:

I havea table in the first field i enter the agent ID#

I would like the second field to lookup the value from
the first field in seprate table and enter the agents
name. I would prefer not to use a drop down list box.

Thanks for any help


.
 
Thanks for the Info John I'll use a form
-----Original Message-----
Hello Everyone,

I was looking for help with the following problem:

I havea table in the first field i enter the agent ID#

I would like the second field to lookup the value from
the first field in seprate table and enter the agents
name. I would prefer not to use a drop down list box.

Thanks for any help

Well, you're misunderstanding how relational databases work!

Tables should NOT contain redundant data. If you can uniquely identify
the agent by their ID, then this table should *not* contain the agent
name.

I suspect that you're using table datasheets for data entry. Don't!
Use a Form instead; on the form you can *display* the agent name while
storing only the ID in the table. A combo box on the Form would be the
best solution, but if you prefer to type the ID manually, put a second
textbox on the form; if the ID textbox is named txtAgentID, set the
Control Source property of the second textbox to

=DLookUp("[AgentName]", "[Agents]", "[AgentID] = " & [txtAgentID])



.
 
Back
Top