Solved

Dlookup

Posted on 2015-01-22
4
138 Views
Last Modified: 2015-01-22
Experts,

I have the follwoiung in the control source of a field.
I get a #name

is this correct?
=DLookUp([Amount],[tblDisbursement_Amounts],"[ID_disb]=" & [ID_disb])
0
Comment
Question by:pdvsa
4 Comments
 
LVL 34

Accepted Solution

by:
PatHartman earned 500 total points
Comment Utility
No.  Each argument must be enclosed in double quotes.

=DLookUp("[Amount]","[tblDisbursement_Amounts]","[ID_disb]=" & [ID_disb])

You also have to be careful with the Name property of a control.  If the control is unbound, as this one is, the Name property cannot be the same value as any field that is bound to the form.  This mistake usually happens when you reuse a control that was added by the wizard or by dragging a field from the field list since in both those cases, Access gives the control Name the value of the bound field.  So, if you originally had a bound field named [Amount] and then changed the expression to this Dlookup() and didn't change the control name, there would be a conflict.
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
All the arguments need quotes:

=DLookUp("[Amount]","[tblDisbursement_Amounts]","[ID_disb]=" & [ID_disb])

Jim.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
You can get help and examples on any Access function here:
http://www.techonthenet.com/access/functions/domain/dlookup.php
0
 

Author Closing Comment

by:pdvsa
Comment Utility
Thank you.  works perfectly.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now