A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using dlookup with a field from the report as a "where condition"



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2007, 01:37 PM posted to microsoft.public.access.reports
MikeG
external usenet poster
 
Posts: 38
Default Using dlookup with a field from the report as a "where condition"

I am try to call the following function in a textbox :
nz(dlookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] = "
&Report!customerid))
from a "company" header ("company grouping" on a report) . The issue I am
having is the "where condition" for customerid. I need to be able to lookup a
new escrow balance for each new company by feeding in the associated new
customerid.

The cutomerid field is part of the data environment of the report. The
function above gets the value from the first row but does not change as the
company groupings change.

Any thoughts?

Thanks
  #2  
Old May 11th, 2007, 03:28 PM posted to microsoft.public.access.reports
Al Campagna
external usenet poster
 
Posts: 647
Default Using dlookup with a field from the report as a "where condition"

mikeg,
If StartEscrow is related to CustomerID, then you should be able to include that field
in the query behind the report, rather than do a DLookup for it.
qryGetEscrowStartBal should be related to (linked) the main query table via CustomerID.
That would be the correct way to do it...

If you must DLookup...
=Nz(DLookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] =
Reports!YourReportName!CustomerID"
Didn't test, but that should do it...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


"mikeg" wrote in message
...
I am try to call the following function in a textbox :
nz(dlookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] = "
&Report!customerid))
from a "company" header ("company grouping" on a report) . The issue I am
having is the "where condition" for customerid. I need to be able to lookup a
new escrow balance for each new company by feeding in the associated new
customerid.

The cutomerid field is part of the data environment of the report. The
function above gets the value from the first row but does not change as the
company groupings change.

Any thoughts?

Thanks



  #3  
Old May 11th, 2007, 03:42 PM posted to microsoft.public.access.reports
Pat Hartman \(MVP\)
external usenet poster
 
Posts: 334
Default Using dlookup with a field from the report as a "where condition"

Try:
=nz(dlookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] = " &
customerid))

An alternative is to just join qryGetExcroStartBal to the query you are
using as the RecordSource for the report. That way, StartEscrow will be in
the recordset and can be bound to a control rather than retrieved via an
expression.

"mikeg" wrote in message
...
I am try to call the following function in a textbox :
nz(dlookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] = "
&Report!customerid))
from a "company" header ("company grouping" on a report) . The issue I
am
having is the "where condition" for customerid. I need to be able to
lookup a
new escrow balance for each new company by feeding in the associated new
customerid.

The cutomerid field is part of the data environment of the report. The
function above gets the value from the first row but does not change as
the
company groupings change.

Any thoughts?

Thanks



  #4  
Old May 11th, 2007, 05:19 PM posted to microsoft.public.access.reports
MikeG
external usenet poster
 
Posts: 38
Default Using dlookup with a field from the report as a "where conditi

Al ,

Thanks for the help. Your're second way worked. But the Escrow amount for
the company grouping only prints out on the first page of my report. Other
companies are processed on more pages but hte Escrow amount is not there for
some reason. Any Thoughts?

Thanks,

Mike

"Al Campagna" wrote:

mikeg,
If StartEscrow is related to CustomerID, then you should be able to include that field
in the query behind the report, rather than do a DLookup for it.
qryGetEscrowStartBal should be related to (linked) the main query table via CustomerID.
That would be the correct way to do it...

If you must DLookup...
=Nz(DLookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] =
Reports!YourReportName!CustomerID"
Didn't test, but that should do it...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


"mikeg" wrote in message
...
I am try to call the following function in a textbox :
nz(dlookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] = "
&Report!customerid))
from a "company" header ("company grouping" on a report) . The issue I am
having is the "where condition" for customerid. I need to be able to lookup a
new escrow balance for each new company by feeding in the associated new
customerid.

The cutomerid field is part of the data environment of the report. The
function above gets the value from the first row but does not change as the
company groupings change.

Any thoughts?

Thanks




  #5  
Old May 11th, 2007, 05:59 PM posted to microsoft.public.access.reports
MikeG
external usenet poster
 
Posts: 38
Default Using dlookup with a field from the report as a "where condition"

Pat thanks

"mikeg" wrote:

I am try to call the following function in a textbox :
nz(dlookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] = "
&Report!customerid))
from a "company" header ("company grouping" on a report) . The issue I am
having is the "where condition" for customerid. I need to be able to lookup a
new escrow balance for each new company by feeding in the associated new
customerid.

The cutomerid field is part of the data environment of the report. The
function above gets the value from the first row but does not change as the
company groupings change.

Any thoughts?

Thanks

  #6  
Old May 13th, 2007, 04:25 AM posted to microsoft.public.access.reports
Al Campagna
external usenet poster
 
Posts: 647
Default Using dlookup with a field from the report as a "where condition"

I would still suggest using your GetEscroeStartBal query linked into the final query, to
provide the EscroeStartBal.
Using a Totals query, I would think a First of [StartEscroe] for each Customer would yield
the correct value.
Then it's a simple matter of Summing in any Group or Report Footer... no "slow" Dlookup...

You're call...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


"mikeg" wrote in message
...
Pat thanks

"mikeg" wrote:

I am try to call the following function in a textbox :
nz(dlookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] = "
&Report!customerid))
from a "company" header ("company grouping" on a report) . The issue I am
having is the "where condition" for customerid. I need to be able to lookup a
new escrow balance for each new company by feeding in the associated new
customerid.

The cutomerid field is part of the data environment of the report. The
function above gets the value from the first row but does not change as the
company groupings change.

Any thoughts?

Thanks



  #7  
Old May 15th, 2007, 04:31 PM posted to microsoft.public.access.reports
MikeG
external usenet poster
 
Posts: 38
Default Using dlookup with a field from the report as a "where conditi

Thanks agan Al. Sounds like good advice.

"Al Campagna" wrote:

I would still suggest using your GetEscroeStartBal query linked into the final query, to
provide the EscroeStartBal.
Using a Totals query, I would think a First of [StartEscroe] for each Customer would yield
the correct value.
Then it's a simple matter of Summing in any Group or Report Footer... no "slow" Dlookup...

You're call...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


"mikeg" wrote in message
...
Pat thanks

"mikeg" wrote:

I am try to call the following function in a textbox :
nz(dlookup("[StartEscrow]","qryGetEscrowStartBal", "[customerid] = "
&Report!customerid))
from a "company" header ("company grouping" on a report) . The issue I am
having is the "where condition" for customerid. I need to be able to lookup a
new escrow balance for each new company by feeding in the associated new
customerid.

The cutomerid field is part of the data environment of the report. The
function above gets the value from the first row but does not change as the
company groupings change.

Any thoughts?

Thanks




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.