recalc subform after orderBy (1 Viewer)

cpampas

Registered User.
Local time
Today, 11:09
Joined
Jul 23, 2012
Messages
218
Hello,
Can you help me understand this :
I do have in my mainForm a control that gets the value of a control in mySubForm footer:

1 - control [sa], in subforms footer : = Avg(Val([anoMaq]))
2 - control [tAno], in myMainFrom =[frmB].[Form]![sa]

it works fine until I run the following code


Code:
Me.OrderBy = "[anomaq]"
    Me.OrderByOn = True

wich orders records in my subform by the field anoMaq . after it executes the value in the textbox control [tAno] in MainForm vanishes
I tried to requery both forms after the orderBy, but still with no results

Code:
Me.OrderBy = "[anomaq]"
    Me.OrderByOn = True
   Me.Form.Requery  ' to requery the subform
   Me.Parent.Requery   ' to requery the main form

I appreciate your help
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:09
Joined
Oct 29, 2018
Messages
21,358
Did you also try using Recalc?
 

cpampas

Registered User.
Local time
Today, 11:09
Joined
Jul 23, 2012
Messages
218
hi theDBguy,
i was trying requery, and refresh, but not recalc
it solved the problem, many thanks for you r kind help
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:09
Joined
Oct 29, 2018
Messages
21,358
hi theDBguy,
i was trying requery, and refresh, but not recalc
it solved the problem, many thanks for you r kind help
You're welcome. It's funny how you titled your topic "recalc," and it's what helped you fix the problem. Good luck with your project.
 

cpampas

Registered User.
Local time
Today, 11:09
Joined
Jul 23, 2012
Messages
218
😂😂 you are right i hadnt notice that. the brain works in misterious ways
 

Users who are viewing this thread

Top Bottom