Me.Requery or Me.Recalc

dullster

Member
Local time
Today, 13:05
Joined
Mar 10, 2025
Messages
75
I have a subform that "On update" of "Amount" I have Me.Recalc to update the Sum on the Main form. When i tab through the end of the line it goes back to the first record instead of a new record. Thoughts on how to fix this?
 
Have you tried Me.Parent.Recalc instead? Just curious...
 
I just tried it, still goes back to the first record not a new record.
 
Here is the DB. Open form Pay Vendor. If I remove the "After Update", Me.Recalc, it will proceed through the form. I am also including Information to enter so you don't have to try to figure it out.
 

Attachments

I have never seen that behavior before. It should be as @theDBguy stated
me.Parent.recalc

But I tried that and still get the same issue.

So to test this further I put a timer and put the cursor in a child record. Then on the timer it recalcs the parent and the subform jumps to the first record. I tested this with refresh and requery. All gave the same behavior. This is not normal, but I cannot explain it.
There must be something I am not seeing.
 

Attachments

  • autokeys.png
    autokeys.png
    6 KB · Views: 10
On my phone so cannot check

What about using refresh?

Or just recalc the required control?

Sounds like the same effect you get on a scrolled textbox - it returns to the top when it loses the focus
 
Totalling for me?
There is nothing in any of the events.
1745143434491.png
 
I have a subform that "On update" of "Amount" I have Me.Recalc to update the Sum on the Main form. When i tab through the end of the line it goes back to the first record instead of a new record. Thoughts on how to fix this?
Hi
Same as Gasman - No Errors
When I entered the data suggested it updates the Total Control and also goes to a new record in the subform.
 
Hi
Same as Gasman - No Errors
When I entered the data suggested it updates the Total Control and also goes to a new record in the subform.
It totaled for me, but when i hit tab as the end of the entry, it goes to the first record instead of a new record.
 
It totaled for me, but when i hit tab as the end of the entry, it goes to the first record instead of a new record.
It goes to a new record for me when I forget to select a client in the combo
The last one is where I remembered to select a client, then that moves to a new record.
So really have no clue what you have done. :(

1745172900718.png
 
I should work so I am not sure what is going on.
This will work
Code:
Private Sub Ctl_Amount_AfterUpdate()
  Me.Dirty = False
End Sub

But this has the downfall that the record is saved. So if you change an amount, but decide you want to escape you can't.
Normally I try not to save a record where the user does not know it was saved.
This is a workaround because there should be a way to recalc the parent, but nothing I tried worked without moving the child record.
 
Last edited:
The fact that =Sum(DataField) only shows the sum of the stored values is the expected behavior. Or am I missing something?

Perhaps the use of OldValue will help.
subsum.ControlSource:
=Nz(Sum([Amount]);0)+IIf([Dirty];Nz([Ctl_Amount].[Value];0)-Nz([Ctl_Amount].[OldValue];0);0)
Note: I only tried this out briefly, but I'm not sure whether it works stable. I expect it to work, but I would test it more before I use it. ;)
 
Last edited:
The problem is when I do Me.Recalc on Amount in the subform and I enter data in the subform, I get to the end of the record it jumps back to the first record and not a new record
 
The behavior that Recalc acts like Requery seems to be related to DataEntry = True.

Quick test: Please rename the DemoClientID textbox to tbDemoClientID and then try adding new data.

Regardless of behavior: What is the purpose of Recalc? Textbox.Requery is also available.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom