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!

Dlookup in a form 1

Status
Not open for further replies.

mchester

Technical User
Jul 1, 2005
13
US
I need to look up a record in a table called caculatedstandard and use a control in a form. I tried this dlookup statement:
=DLookUp([CIMPROV<1200],[CACULATEDSTANDARD],[GRADE]=[Form]!APPRAISERPRODUCTION!GRADE2)
I get a #name error

thanks

mike
 
You need to include the names of fields inside quotation marks. For example:

=DLookUp("[CIMPROV<1200]","[CACULATEDSTANDARD]","[GRADE]=" & [Form]!APPRAISERPRODUCTION!GRADE2)

If the field Grade2 is a number, it will work as is. If it is a string, you will need to place apostrophes either side of the number. IF it is a date field a hash character will need to be placed either side of the field inside double quotes.

John
 
I used the funcion:
=DLookUp("[CIMPROV<1200]","[CALCSTANDARD]","[GRADE]=" & [Form]!APPRAISERPRODUCTION!GRADE2)

I change the name of the table calculatedstandard to the above table and change the function also.
I still receive a #name error. My grade field is a number and a text box on my form appraiserproduction. The grade2 is a text box named grade2 with the control source =2.

I have no idea, thanks for your help.
 
=DLookUp("[CIMPROV<1200]","[CALCSTANDARD]","[GRADE]=" & [Forms]!APPRAISERPRODUCTION!GRADE2)

Spot the typo. A quick point: With the grade2 textbox with a controlsource equal to 2 (in other words, it uses a field called 2 on a bound form), why not just set the criteria clause of Dlookup to pick up values where grade=2?
For example:

=DLookUp("[CIMPROV<1200]","[CALCSTANDARD]","[GRADE]=2")

If you meant to have a value of 2 in the box, set the controlsource to blank and the default value property to 2.

John
 
jrbarnett

thanks for the help I have been trying since my last post this is what I finally got to work.

=DLookUp("[CIMPROV<1200]","[CALCSTANDARD]","[CGRADE]=[GRADE]")

I would never get through all this with out all of the help I get from this site.

Tek-Tip and its members is my genie in the bottle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top