pressMac
asked on
subform / main form not recalculating with SQL Server
I have an access XP app that is being converted to 2013 with SQL Server. There is a typical subform / main form with a subform with Quantity, Retail, Days and calculated control Amount (controlsource==[Quantity] *[Retail]* [Days] )
On the older version working since 2.0, when Quantity was updated, Amount would update, When that line was updated, the subtotal on the main form would update. Now Neither update happens.
I have been able to force the Amount control in the line to update with an Me.Amount.Requery in the afterupdate of Quantity, Retail, and Days. That is nice and clean.
Subform Detail Controls:
Quantity, Retail, Day, Amount (controlsource = =[Quantity]*[Retail]*[Days ])
Subform Footer Controls:
Subtotal (controlsource = =Sum([Quantity]*[Retail]*[ Days]) )
Main Form Controls:
Subtotal =IIf(IsNull(Forms!frmJobs! ctl_subLI. Form!Subto tal),0,For ms!frmJobs !ctl_subLI .Form!Subt otal)
I have tried many variations to get the subtotal to update WITHOUT a requery or recalc. When i do that it sends the cursor back to top.
I have the subform visible and can see that the subform total does not update when you move off the detail record to and detail record.
Here is the Subform After Update and some of what i have tried. Non work with a whole refresh or requery.
Me.Amount.Requery
Me.Subtotal.Requery
Me.Refresh
Me.Parent.Subtotal.Requery
Me.Parent.Refresh ' This will make it update, but moves cursor to top
'Me.Recalc ' this will work but moves cursor to top
Is there a way to resolve this behavior? I would rather not have to whole form refresh since the way it repaints is not that nice, and the cursor goes to top.
On the older version working since 2.0, when Quantity was updated, Amount would update, When that line was updated, the subtotal on the main form would update. Now Neither update happens.
I have been able to force the Amount control in the line to update with an Me.Amount.Requery in the afterupdate of Quantity, Retail, and Days. That is nice and clean.
Subform Detail Controls:
Quantity, Retail, Day, Amount (controlsource = =[Quantity]*[Retail]*[Days
Subform Footer Controls:
Subtotal (controlsource = =Sum([Quantity]*[Retail]*[
Main Form Controls:
Subtotal =IIf(IsNull(Forms!frmJobs!
I have tried many variations to get the subtotal to update WITHOUT a requery or recalc. When i do that it sends the cursor back to top.
I have the subform visible and can see that the subform total does not update when you move off the detail record to and detail record.
Here is the Subform After Update and some of what i have tried. Non work with a whole refresh or requery.
Me.Amount.Requery
Me.Subtotal.Requery
Me.Refresh
Me.Parent.Subtotal.Requery
Me.Parent.Refresh ' This will make it update, but moves cursor to top
'Me.Recalc ' this will work but moves cursor to top
Is there a way to resolve this behavior? I would rather not have to whole form refresh since the way it repaints is not that nice, and the cursor goes to top.
ASKER
I will try this, but interested to know why the behavior is different than before.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did not really use the solution, but it helped me find the solution.
Basically, I would refresh the data, and then use DoCmd.GoToRecord to go back to the record where you were.
Regarding the refresh not looking nice, I would suggest using
Open in new window
or
Open in new window