Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate unbound text box

Status
Not open for further replies.

kfoley

Programmer
Jul 23, 2002
4
US
Instead of using a subform to do this, can I populate a text box based on the value another text box?

I have one field that displays a name, lookup list that uses the AddressBook and return the PersonID. Once the name has been selected using AfterUpdate I want to populate the next textbox with the email information.

This is the basic logic

email.text = tblAddressBook.email where me.personID = tblAddressBook.personID

Any ideas? Hopefully I have explained this correctly.

Kim
 
Sure, you can do this. Does the form have a Recordsource or is it unbound? If it is bound, is the record that contains the email address in the recordset? Based on your answer, I can suggest a method to retrieve the email address. dz
dzaccess@yahoo.com
 
Hi Kim!

You can do it like this:

email.text = DLookUp("email", "tblAddressBook", "[tblAddressBook]![personid] = '" & Me!personID.Value & "'")

this assumes that the personid is text. If it is numeric then you will not need the single quotes or the last set of double quotes.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Jeff,

Thank you so much it works like a dream.

Kim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top