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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E-mail address lookup probs 1

Status
Not open for further replies.

rleestma

Technical User
Jul 31, 2001
99
US
Hi. In my form, I have a field that looks up personnel records, then stores a personnel name in my project record. Now, I need to have a button in my project record that looks up that employee's E-mail address!

In Ryan VB talk, this would equate to:

Where Employee = Personnel.Employee Get EMailAddress

I am a VB NEWbie, so ANY help would be appreciated!

The reason I need to do this is so that I can reference data in my project record in a DoCMD.SendObject clause...

Thanks!

Ryan
 
Where is the email address kept?

If it is in the same table as the personnel data you can just save it with the project data.

If it is in a different table you need to know and save the key field data that relates the email address to the employee saved with the project. Then you can use the DLOOKUP function to find the email address based on the key field.

txtEmailAddress = DLOOKUP("email_field", "Table_Email _ Is_In", "Key_Field = '" & TxtEmployee_Related_Data_In_Project & "'")

will find it for you.

Larry
SDC
 
It's not working...

=DLookUp("EMailAddress","Personnel Query","Full Name = " & [Pre-Scope Completed By] & "")

I created a new unbound text box, and entered the expression above into the control source. EMailAddress is the name of the text field I want to retrive, Personnel Query is where my data is contained, and the FULL NAME field in the Personnel Query is what matches Pre-Scope Completed By.

Pre-Scope Completed By is what is in my project...

What's wrong?

Ryan
 
Try this:

=DLookUp("[EMailAddress]","Personnel Query","[Full Name]=[Pre-Scope Completed By]")

HTH
Joe Miller
joe.miller@flotech.net
 
Joe is the man, again...

THANKS!!!!

Ryan Leestma
 
The code I gave you works also. You just forgot the single quotes that need to surround the variable. One goes after the equals (=) sign and before the second double quotes ("). The other one goes between the ending pair of double quotes. Look at my example again.

Larry
SDC
 
LDeMaio,

Your example won't work because there are no brackets around the field names in either the target or the criteria. The brackets are required when using any domain aggregate function while referencing a field name. Table names must have NO brackets in order to be properly evaluated.

HTH Joe Miller
joe.miller@flotech.net
 
Actually, it worked beautfully... Thanks guys!!!

 
I apologize to Larry, after seeing that it worked, I tested myself and it does. I have always been one to follow the Online Help syntax to the tee and didn't think that it worked without the []'s.
Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top