From: Pamela on
I have a code that I've copied and used several times but it isn't working in
this one instance. The control to which this is attached is on a subform
nested 4 deep. The control to which it is referring "Measurements" is on
Subform3 (the parent of subform4). Here's my code:
DLookup("Expr1", "qryMeasurements", "Measurements = " &
Me.Parent!Measurements) & " "
Please let me know what I may be missing. Thanks so much!
Pamela
From: theDBguy on
Hi Pamela,

Not sure if this will work but try this syntax:

Me.Parent.Form!Measurements

Hope that helps...


"Pamela" wrote:

> I have a code that I've copied and used several times but it isn't working in
> this one instance. The control to which this is attached is on a subform
> nested 4 deep. The control to which it is referring "Measurements" is on
> Subform3 (the parent of subform4). Here's my code:
> DLookup("Expr1", "qryMeasurements", "Measurements = " &
> Me.Parent!Measurements) & " "
> Please let me know what I may be missing. Thanks so much!
> Pamela
From: Pamela on
Hi DBguy,
Something I just realized is that I ONLY get this Syntax Error when the
field is skipped which is then Null. I do have an expression set in my query
to give a result for a null value but I think that's what's throwing this
off. Any suggestions for how to handle that??

"theDBguy" wrote:

> Hi Pamela,
>
> Not sure if this will work but try this syntax:
>
> Me.Parent.Form!Measurements
>
> Hope that helps...
>
>
> "Pamela" wrote:
>
> > I have a code that I've copied and used several times but it isn't working in
> > this one instance. The control to which this is attached is on a subform
> > nested 4 deep. The control to which it is referring "Measurements" is on
> > Subform3 (the parent of subform4). Here's my code:
> > DLookup("Expr1", "qryMeasurements", "Measurements = " &
> > Me.Parent!Measurements) & " "
> > Please let me know what I may be missing. Thanks so much!
> > Pamela
From: Dorian on
What kind of data is in Measurements?
If it is text rather than a number, you need to include the value in your
DLookup in single quotes. e.g.
"Measurements = '" Me.Parent!Measurements & "'")

I'd also lookup in Access help on Subforms especially how to refer to one
subforms controls from another.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"Pamela" wrote:

> I have a code that I've copied and used several times but it isn't working in
> this one instance. The control to which this is attached is on a subform
> nested 4 deep. The control to which it is referring "Measurements" is on
> Subform3 (the parent of subform4). Here's my code:
> DLookup("Expr1", "qryMeasurements", "Measurements = " &
> Me.Parent!Measurements) & " "
> Please let me know what I may be missing. Thanks so much!
> Pamela
From: Linq Adams via AccessMonster.com on
You syntax is for DLookUp() is incorrect for either Text or Numeric field.

Assuming that your reference to

Me.Parent!Measurements

is correct, in your original code (I haven't worked with sub/subforms like
this)

If Measurements is Numeric it would be:

DLookup("Expr1", "qryMeasurements", "Measurements = " & Me.Parent!
Measurements)

If Measurements is Text:

DLookup("Expr1", "qryMeasurements", "Measurements ='" & Me.Parent!
Measurements & "'")

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201001/1