DSum in Report

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

Guest

Someone suggested I try this DSum, but it isn't exactly what I need because I
don't really need to sum anything. And, when any field the code is using in
the criteria is text instead of a number, it won't work for me. Can someone
suggest something different.

This is the example they gave me that they have used in a text box on a
report:
=DSum("P","qryMa","m=1 and v=1")
They are summing "P" for the query "qryMA" where "m"=1 and "v"=1.
They have setup multiple text boxes on their report to look like a
spreadsheet and it works very well for them.

But, I have a very complicated existing report. I need to add some
additional information. The information will come in as a list when I need
to show it as if it were record. (It needs to show as one line beneath each
corresponding part number on the report) The current report has a lot of
calculations in the underlying query. I really don't want to mess with the
existing query.

Is there some way, I can use a text box in a report to just call the
information from a different query...such as:
=("Qty","qryA","B=1" and "FPN=C188") And is there some way in the report
itself to connect the "FPN" finished part number - to the corresponding FPN
in the report?
I don't really think so, but thought I'd give it a try.
 
Perhaps the DLookup function is what you seek. Check it out in Help file and
post back if you have questions.
 
Thank you. DLookUp does bring the text in for me. But, I can't figure out
how to add criteria. I tried the following

=DLookUp("P","qryt","b=2 and f=1")
it just shows an error.
 
Are P, b, and f the names of fields in the query qryt? Are b and f numeric
fields?

--

Ken Snell
<MS ACCESS MVP>
 
Text fields, eh.... then the criterion expression must delimit the values
with ' characters:

=DLookUp("P","qryt","b='2' and f='1'")
 
Ta Da!
Thank you so much!

Ken Snell said:
Text fields, eh.... then the criterion expression must delimit the values
with ' characters:

=DLookUp("P","qryt","b='2' and f='1'")
 
Back
Top