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!

Dlookup problem

Status
Not open for further replies.

billheath

Technical User
Mar 17, 2000
299
US
I have a DLookup on a form. The form is based on a table "Daily_Value". The lookup is based on a Table called "Cry_Cn". The formula I am trying to use is:

=DLookUp("[Cur_Quanity]","[Cry_Cn]","[Symbol] = " & " [Symbol]"). I am pretty sure that the problem lies with the Caption "Symbol" or the use of the quotes and commas. Any help would be appreciated.
 
billheath,
This really depends on the data type of Symbol. Can we assume it's text? If so, try:

Code:
=DLookUp("[Cur_Quanity]","[Cry_Cn]","[Symbol] = """ &  [Symbol] & """")

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thank you. That worked! Can you explain why it needed so many quotation marks. I'm confused!
 
First, strings must be surrounded by quotes. I could have suggested the following which works unless there is a single quote in a [Symbol] value (last names often contain single quotes).

Code:
=DLookUp("[Cur_Quanity]","[Cry_Cn]","[Symbol] = '" &  [Symbol] & "'")

I typically use double-quotes [highlight #FCE94F]"[/highlight] which need to be doubled up. Placing [highlight #FCE94F]"[/highlight] inside [highlight #FCE94F]"[/highlight]s require the [highlight #FCE94F]""[/highlight]. I don't really know how to better explain this.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
All I know is that it worked! Thank you again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top