Dlookup HELP

F

FSUrules2883

I am trying to use a DLOOKUP in a report To lookup a value in a stored
query from information that is the report. I have a report that gives
me a customers parent account name and I am trying to then use that
parent account name to look up a comment stored in another query.
This is how my formula looks

=DLookUp("TXTFIELD","Query","Query.ParentAccount"="ParentAccountFromReport")

Any sugesstions?
 
J

John Spencer

Perhaps something along the lines of
=DLookUp("TXTFIELD","Query","ParentAccount=""" & ParentAccountFromReport
& """")


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
F

fredg

I am trying to use a DLOOKUP in a report To lookup a value in a stored
query from information that is the report. I have a report that gives
me a customers parent account name and I am trying to then use that
parent account name to look up a comment stored in another query.
This is how my formula looks

=DLookUp("TXTFIELD","Query","Query.ParentAccount"="ParentAccountFromReport")

Any sugesstions?

You need to know the datatype of [ParentAccount].
If it is a Number datatype, then:

=DLookUp("TXTFIELD","Query","[ParentAccount] "= [Name of Control on
Report])

If [ParentAccount] is a Text datatype, then:

=DLookUp("TXTFIELD","Query","[ParentAccount] '"= [Name of Control on
Report] & "'")

Change Txtfield, Query, [ParentAccount] and [Name of Control on
report] to the actual names used.

Look up DLookUp as well as
Restrict data to a subset of records
in VBA help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top