Doing a calculation and displaying

  • Thread starter Thread starter bob
  • Start date Start date
B

bob

Hello,

I have a form that I have created to track information on
trouble reports we turn into a vendor. I have created 2
other forms to act as subforms. On the main form i have
created 2 command buttons that will open the other forms.
when I create the buttons, i linked the forms together
using a common data field that is in each form.

So, the common field is BugNumber. I have a billing table
that has a column called BugNumber. 1-many relation ship.
I enter in a bugnumber, date billed, and billed amount as
I get billing statments from the vendor.

So, on the main form i navigate to a form showing me
BugNumber 4. I can then hit the Billing command button
and a popup datasheet shows me the amounts billed to me to
date.

Now, I want to display on the main form a calculated field
that shows me the total amount billed to date for a given
bug number. It should be an easy matter to sum values for
a given bug number from the billing table/form. I created
my text box, and then modified the control source.

Problem is that I can't get the proper format to get me
any data. I keep getting #Name? or #Error.

Help. Is there a better way? I don't want to constantly
display the subforms and I don't want to do a ton of VBA.

Thansk
Bob
 
Bob,

You may have already tried this, but I think you may want
to try the Dsum function with bug number as criterion.
You may be trying to sum values for an object that is not
open. Look at dsum...see if it helps.
 
WOHOOOOO!! Thanks..that did the trick!
-----Original Message-----
Here is the Expression i built.
=DSum([Billing]![Billed Amount],[Billing],[Billing]![PCR] =
[PCR])

The arguments to DSum are *TEXT STRINGS*. You're passing the values of
controls.

Try

=DSum("[Billed Amount]", "[Billing]", "[PCR] = " & [PCR])

If PCR is a field of Text type you need the syntactically required
quotemarks:

=DSum("[Billed Amount]", "[Billing]", "[PCR] = '" & [PCR] & "'")


.
 
Back
Top