From: Pamela on
I tried that, Dorian, but it isn't giving me anything now - just as though
that code isn't there which perhaps is better than an error...LOL But it
isn't returning anything for that piece of code. The query to which this is
referring has an expression that if the Measurements value is null, then text
is returned stating that there are no measurements but otherwise, text is
concatenated w/ the text in my measurements control stating that the height
of the damage is __ inches.
Any other ideas???

"Dorian" wrote:

> 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: Pamela on
Hi Linq,
The field is text, and I tried changing it to include the extra " ' "s that
you instructed and someone else instructed but I'm still not getting it to
work. With that, the code doesn't give an error but it literally returns
blank. Note though that my original code works perfectly IF there's a value
entered. I'm only having this problem if the field is null. Any additional
help would be really great!

"Linq Adams via AccessMonster.com" wrote:

> 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
>
> .
>
From: theDBguy on
Hi Pamela,

In that case, you could probably use an IIf() statement. For example:

=IIf(<test for skipped record>, "Record Skipped", DLookup(...))

Hope that helps...


"Pamela" wrote:

> 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