Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-16-2012, 06:28 AM   #1
Big Pat
Newly Registered User
 
Join Date: Sep 2004
Location: A long way from Tipperary!
Posts: 555
Thanks: 30
Thanked 5 Times in 5 Posts
Big Pat is on a distinguished road
Where have I gone wrong with this DLOOKUP?

I have a control named PI on my subform which looks up values from a table called "PI Names" (principal investigators of clinical studies, not private eyes!!) This works OK and allows me to select an entry.

Now I want to have the PIs email address, which is stored in the same table, displayed on the form. This is what I have come up with.

=DLookUp("[PI Email Address]","PI Names","[Name]=[Forms]![frm01Study]![frm02 Site]![PI]")

But when I open the form, it just flashes #Error really quickly.

I know I shouldn't really have spaces in the field names, but rather than normal tables, my database links to Sharepoint lists and I can't change the list settings as several other things would be affected. Is it somthing to do with quotes and/or brackets, I wonder?

Thanks,

__________________
I think my keyboard is running low on toner.
Big Pat is offline   Reply With Quote
Old 11-16-2012, 06:31 AM   #2
Big Pat
Newly Registered User
 
Join Date: Sep 2004
Location: A long way from Tipperary!
Posts: 555
Thanks: 30
Thanked 5 Times in 5 Posts
Big Pat is on a distinguished road
Re: Where have I gone wrong with this DLOOKUP?

Quote:
Originally Posted by Big Pat View Post
I have a control named PI on my subform which looks up values from a table called "PI Names" (principal investigators of clinical studies, not private eyes!!) This works OK and allows me to select an entry.

Now I want to have the PIs email address, which is stored in the same table, displayed on the form. This is what I have come up with.

=DLookUp("[PI Email Address]","PI Names","[Name]=[Forms]![frm01Study]![frm02 Site]![PI]")

But when I open the form, it just flashes #Error really quickly.

I know I shouldn't really have spaces in the field names, but rather than normal tables, my database links to Sharepoint lists and I can't change the list settings as several other things would be affected. Is it somthing to do with quotes and/or brackets, I wonder?

Thanks,

Sorry...I'm an idiot. I didn't need to refer to the form at all.

=DLookUp("[PI Email Address]","PI Names","[Name]=[PI]") works.

I engaged keyboard before brain again
__________________
I think my keyboard is running low on toner.
Big Pat is offline   Reply With Quote
Old 11-16-2012, 06:36 AM   #3
Simon_MT
Newly Registered User
 
Join Date: Feb 2007
Location: United Kingdom
Posts: 2,177
Thanks: 2
Thanked 162 Times in 158 Posts
Simon_MT has a spectacular aura about Simon_MT has a spectacular aura about
Re: Where have I gone wrong with this DLOOKUP?

Here's a tip:

=DLookUp("[Employee Name]","[Employees]","[Employee]= '" & [Forms]![Clients Sales Enquiry]![Client Sale Employee] & "'")

If you change Clients Sales Employee (string value) then so does this label.

Simon

Simon_MT is offline   Reply With Quote
Reply

Tags
dlookup access forms

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with this DLookup syntax? buratti Modules & VBA 11 01-09-2010 05:28 PM
Dlookup returns WRONG entries thisisntwally Modules & VBA 15 08-29-2007 06:29 AM
Dlookup updating wrong table stretch66 Forms 0 11-16-2005 07:08 AM
What is wrong with this DLookup? Tell me before I kill someone... pyramidofpiffle Forms 10 04-14-2005 01:29 AM
Query with Dlookup returning wrong value bennybee Queries 1 01-22-2004 08:02 PM




All times are GMT -8. The time now is 03:57 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World