Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OrderBy in Sub form clears Filter in parent form 1

Status
Not open for further replies.

waldemar

Programmer
Nov 15, 2001
245
DE
Something interesting....

When I apply an ORDERBY Property in a SUB FORM (via VBA), it affects the FILTER Property of the PARENT FORM. In my case the filter was simply cleared out; I spent hours looking for the bug ("Why do I see all instead of the filtered entries?") until removed "Me.OrderBy = [orderdata]" from the Form_Current Event of the SUBFORM!...

Has anybody expierenced something similar?
 
I can't explain why, but the OrderBy clause causes a one time recursive call to the On Current event. I have noticed that it will also clear the Add Mode side of things if you use it in a form that has been called via docmd.openform in add mode. They are probably related somehow but at a level deeper than I know.

One possible workaround might be to define the query behind your subform in code and attach it to the subforms data source. That way you could include an orderby in the sql which I don't think would impact you.

Hope this helps! Good Luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top