DLookUp troubles

MICHELE

Registered User.
Local time
Today, 06:41
Joined
Jul 6, 2000
Messages
117
I am trying to view information from a query field on a form that is bound by another query so I am trying to use DLookUp.
The form with the field is F-MainEntry. The query that is not bound to the form is Q-PURCHEXPORT2 and the field is STEEL. My DLookUp looks like this and is not working

DLookUp("[STEEL]","[Q-PURCHEXPORT2]","[LSC]=Form![F-MainEntry].[LSC]")

I've tried it a few different ways with no luck. Any help would be greatly appreciated!
 
If LSC is an integer
DLookUp("[STEEL]","[Q-PURCHEXPORT2]","[LSC]= " & Forms!F-MainEntry!LSC)

or

If LSC is text
DLookUp("[STEEL]","[Q-PURCHEXPORT2]","[LSC]= '" & Forms!F-MainEntry!LSC & "'")
 
Thank you.
I actually copied what you wrote and pasted it and it still doesn't work. LSC is a text field.
Could it have something to do with my query? The field STEEL is actually made from an expression.
 
No that does not matter. Is the LSC in Forms!F-MainEntry!LSC the name of a control or field value.
You do not actually need the [] around the query name

DLookUp("[STEEL]","Q-PURCHEXPORT2","[LSC]= '" & Forms!F-MainEntry!LSC & "'")

You should, however avoid using operators in the names of your fields, query names etc. Use an underscore _ instead.
 
OK. I changed the name of my form and my query and used this expression and it still won't work. I get #Name?

DLookUp("[STEEL]","Q_PurchExport","[LSC]= '" & Forms!F_MainEntry!LSC & "'")

Any other suggestions??

I'm going home now and will try again Monday. Thank You!
 
Have you preceded it with an = sign?
Also is the name of the form control correct ie the LSC in Forms!F_MainEntry!LSC ?
 
Thank you so much, both of you! It works now. I have been working with Access a while, but I steel need to learn so much. I will try to remember correct naming standards. It's gotten me in trouble before. I wish I could change them all that I did in the huge db that I already have.

Thanks again!
This Forum has been a job saver, literally!!
 

Users who are viewing this thread

Back
Top Bottom