How do I set a table lookup on a form in MS Access?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database containing 3 tables
Clients
Items
Rents
THe database is for a rental company, I have created a form to enter rents
but when I type in the customer ID I want the table to lookup customer ID in
the clients table and input the customers name automatically for me.
Any ideas?

Thanks!
Steve
 
hi,
you might have luck with DLookup.
Look it up in help for more info. here is the syntax.
DLookup("[customerName]", "clients", "[customerID] = '" &
Me.txtcustomerID & "'")
Regards
Frank
 
I have a database containing 3 tables
Clients
Items
Rents
THe database is for a rental company, I have created a form to enter rents
but when I type in the customer ID I want the table to lookup customer ID in
the clients table and input the customers name automatically for me.
Any ideas?

If you're trying to store the customer's name in the Rents table...
DON'T!

The whole POINT of a relational database is that you store data
*once*. The name should be stored in the Clients table, and *ONLY*
there. If you want to see it in conjunction with Rents information you
have several choices; on your Form, use a Combo Box based on the
Clients table; bind it to the CustomerID but have it display the
customer name (the combo wizard will walk you through this, or post
back if it's not working).

For a Report you can create a Query joining [Clients] to [Rents] by
CustomerID. You can pick the rental information fields from Rents, and
the customer name from Clients; there is neither any need nor benefit
to inputting the customer name redundantly.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top