Question Need Help with DLookup on a Form (in Access 2010)

mahunter

New member
Local time
Today, 05:37
Joined
Nov 5, 2013
Messages
8
I'm having a lot of trouble trying to get the Dlookup function to work within a database on a Form, looking up information from a Table.

What I want to have happen is for Access to pull in (via the DLookup functions) parameters by grade or recipe on a data entry Form(CenterlineDataEntryForm) from another table that contains the grade recipes(CenterlineDataLimits). I get a ERROR! in the text box on the form when I use the code below.


Here's the code I'm using:
=DLookUp("[Target]","[CenterlineLimits]","Grade]='" & [Forms]![CenterlineDataEntryForm]![Grade] & "'")

I've also attached the database for reference. The test code is in Wetlap Fresh Water Flow Target on the CenterlineDataEntry Form.

The user sets the grade code (or product type) on the CenterlineDataEntryForm, and based on that selection of the grade, I want the "recipe" limits on the CenterlineDataEntryForm to change based on that grade selection (these limits are on the Form as Text Boxes).

Attached is a screen shot of the Form with the Error! which you can see under Wetlap Water Flow: Target.

I can email the database (it's about 12mb) to anyone willing to help me out here, or send a Dropbox link to it.

Thanks and please help!,
Mark
 

Attachments

  • Screen Shot of Centerline Database with DLookup Error 11-5-13.jpg
    Screen Shot of Centerline Database with DLookup Error 11-5-13.jpg
    16.8 KB · Views: 125
looks like you are missing a square bracket

Code:
=DLookUp("[Target]","[CenterlineLimits]","[SIZE=4][COLOR=red][B][[/B][/COLOR][/SIZE]Grade]='" & [Forms]![CenterlineDataEntryForm]![Grade] & "'")

Also if this textbox is in the CenterlineDataEntryForm you only need

Code:
=DLookUp("[Target]","[CenterlineLimits]","[Grade]='" & me.Grade & "'")

Finally, this assumes that Grade is text and not a number. If it is a number then you need
Code:
=DLookUp("[Target]","[CenterlineLimits]","[Grade]=" & me.Grade)
 
:)
looks like you are missing a square bracket

Code:
=DLookUp("[Target]","[CenterlineLimits]","[SIZE=4][COLOR=red][B][[/B][/COLOR][/SIZE]Grade]='" & [Forms]![CenterlineDataEntryForm]![Grade] & "'")

Also if this textbox is in the CenterlineDataEntryForm you only need

Code:
=DLookUp("[Target]","[CenterlineLimits]","[Grade]='" & me.Grade & "'")

Finally, this assumes that Grade is text and not a number. If it is a number then you need
Code:
=DLookUp("[Target]","[CenterlineLimits]","[Grade]=" & me.Grade)


This fixed it!!! Thank you so much,
Mark
 

Users who are viewing this thread

Back
Top Bottom