Dlookup function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using this function in a report. In all the text boxes I am using the
function I specify the same query it should take the data from.

I the record source of the report I put the query name as well.

I created a copy of this report, changing the record source to another
query, and then had to go to all the text boxes and change the query name as
well. It's quite tidious and I was wondering whether there's a way in the
dlookup function to specify the record source query property so it will pick
it up automatically?

Thanks.

Arnon
 
Generally, DLookup() should not be needed in a report if the record source
is the same as your report.

However, Ken Snell posted a while back that you can use something like:

=DLookUp("CompanyName",[RecordSource],"CustomerID=""" & [customerID] & """")

I'm not sure why you would need to use DLookup() when the field is available
in the record source.
 
Well, I might not need it, but I'll tell you what I need: The query shows P&L
account grouping and numbers. It's not a regular report that show grouping
10,20,30,40... and the total. What I need is in something like: grouping
10,20 and then a line that sums 10+20 together, then 30,40,50 (from the
query) and then a line that sums 30+40+50 together. There's also a line that
subtracts revenue from expenses. I managed to do that using dlookups, but
understand there are more effective way.

Could you please tell me, based on my explanation of what I need, how to do
it?

Thanks,

Arnon

Duane Hookom said:
Generally, DLookup() should not be needed in a report if the record source
is the same as your report.

However, Ken Snell posted a while back that you can use something like:

=DLookUp("CompanyName",[RecordSource],"CustomerID=""" & [customerID] & """")

I'm not sure why you would need to use DLookup() when the field is available
in the record source.

--
Duane Hookom
MS Access MVP
--

Arnon said:
I am using this function in a report. In all the text boxes I am using the
function I specify the same query it should take the data from.

I the record source of the report I put the query name as well.

I created a copy of this report, changing the record source to another
query, and then had to go to all the text boxes and change the query name
as
well. It's quite tidious and I was wondering whether there's a way in the
dlookup function to specify the record source query property so it will
pick
it up automatically?

Thanks.

Arnon
 
You need to have fields in tables that categorize your 10+20 together, then
30,40,50. Similar with having a stored value that identifies revenue and
expenses. For instance if 10 and 20 have a field with a common value of "A"
then you can group by this field and get a total of the "A"s.

--
Duane Hookom
MS Access MVP


Arnon said:
Well, I might not need it, but I'll tell you what I need: The query shows
P&L
account grouping and numbers. It's not a regular report that show grouping
10,20,30,40... and the total. What I need is in something like: grouping
10,20 and then a line that sums 10+20 together, then 30,40,50 (from the
query) and then a line that sums 30+40+50 together. There's also a line
that
subtracts revenue from expenses. I managed to do that using dlookups, but
understand there are more effective way.

Could you please tell me, based on my explanation of what I need, how to
do
it?

Thanks,

Arnon

Duane Hookom said:
Generally, DLookup() should not be needed in a report if the record
source
is the same as your report.

However, Ken Snell posted a while back that you can use something like:

=DLookUp("CompanyName",[RecordSource],"CustomerID=""" & [customerID] &
"""")

I'm not sure why you would need to use DLookup() when the field is
available
in the record source.

--
Duane Hookom
MS Access MVP
--

Arnon said:
I am using this function in a report. In all the text boxes I am using
the
function I specify the same query it should take the data from.

I the record source of the report I put the query name as well.

I created a copy of this report, changing the record source to another
query, and then had to go to all the text boxes and change the query
name
as
well. It's quite tidious and I was wondering whether there's a way in
the
dlookup function to specify the record source query property so it will
pick
it up automatically?

Thanks.

Arnon
 
Back
Top