Home All Groups Group Topic Archive Search About

Can Add but Can't Subtract

Author
24 Feb 2005 11:03 PM
DS
I Have a form set up with 2 Subforms on it.
At the bottom of the Main Form I have a Total field that grabs the
totals from each of the subforms.  It works fine when I add records, but
when I delete a record the old number just lies there untill I add a new
record.  I put requery into the code but that doesn't seemm to work.
Any help would be appreciated.
Thank You
DS

Author
25 Feb 2005 2:47 AM
John Vinson
On Thu, 24 Feb 2005 18:03:17 -0500, DS <booty***@optonline.net> wrote:

>I Have a form set up with 2 Subforms on it.
>At the bottom of the Main Form I have a Total field that grabs the
>totals from each of the subforms.  It works fine when I add records, but
>when I delete a record the old number just lies there untill I add a new
>record.  I put requery into the code but that doesn't seemm to work.
>Any help would be appreciated.
>Thank You
>DS

Use Me.Recalc instead of Requery.

                  John W. Vinson[MVP]
Author
25 Feb 2005 4:19 AM
DS
John Vinson wrote:
Show quote
> On Thu, 24 Feb 2005 18:03:17 -0500, DS <booty***@optonline.net> wrote:
>
>
>>I Have a form set up with 2 Subforms on it.
>>At the bottom of the Main Form I have a Total field that grabs the
>>totals from each of the subforms.  It works fine when I add records, but
>>when I delete a record the old number just lies there untill I add a new
>>record.  I put requery into the code but that doesn't seemm to work.
>>Any help would be appreciated.
>>Thank You
>>DS
>
>
> Use Me.Recalc instead of Requery.
>
>                   John W. Vinson[MVP]   
I'll give it a try.
Thanks
DS
Author
25 Feb 2005 5:51 PM
DS
DS wrote:
Show quote
> John Vinson wrote:
>
>> On Thu, 24 Feb 2005 18:03:17 -0500, DS <booty***@optonline.net> wrote:
>>
>>
>>> I Have a form set up with 2 Subforms on it.
>>> At the bottom of the Main Form I have a Total field that grabs the
>>> totals from each of the subforms.  It works fine when I add records,
>>> but when I delete a record the old number just lies there untill I
>>> add a new record.  I put requery into the code but that doesn't seemm
>>> to work. Any help would be appreciated.
>>> Thank You
>>> DS
>>
>>
>>
>> Use Me.Recalc instead of Requery.
>>
>>                   John W. Vinson[MVP]   
>
> I'll give it a try.
> Thanks
> DS

I tried it and it didn't work...

Heres the DSum that I'm using...
The TotMod is a calculated field...could that be the problem..?

Me.Parent.[Mods Detail]!MDTS = nnz(DSum("[TotMod]", "Mods Detail Query",
"[Order ID] = " & Me.Parent![Order ID]))
     Me.Parent!txtSubTotal = nnz(Me.ODT) _
                     + nnz(Me.Parent.[Mods Detail]!MDTS)

Thanks
DS
Author
26 Feb 2005 5:50 AM
John Vinson
On Fri, 25 Feb 2005 12:51:23 -0500, DS <booty***@optonline.net> wrote:


>Heres the DSum that I'm using...
>The TotMod is a calculated field...could that be the problem..?
>
>Me.Parent.[Mods Detail]!MDTS = nnz(DSum("[TotMod]", "Mods Detail Query",
>"[Order ID] = " & Me.Parent![Order ID]))
>     Me.Parent!txtSubTotal = nnz(Me.ODT) _
>                     + nnz(Me.Parent.[Mods Detail]!MDTS)

What's Mods Detail? And what's MDTS? The syntax

Me.Parent

means the parent form - and the Me may be unneeded. I'd just use

Parent!controlname

Also, nnz is not a function which I recognize; is it a private version
of Nz()?

                  John W. Vinson[MVP]

AddThis Social Bookmark Button