Ordering records in a subform

  • Thread starter Thread starter Ed Warren
  • Start date Start date
E

Ed Warren

Form A contains Form B as a subform
in Form B's onopen event I have set the sort order as:

Private Sub Form_Open(Cancel As Integer)
Me.OrderBy = "[datetimecreated] DESC"
End Sub

When the Form A opens and I select a record the detail records in Form B
fail to be ordered as required.

So how, and where should I put the code to force the proper sorting of the
records.

Thanks,

Ed Warren.
 
So how, and where should I put the code to force the proper sorting of the

Create a query sorted the way you want and use it for Form B's source.

Tom Lake
 
Thanks, sometimes the really stupid tricks are overlooked!!! I was making
this much too hard.

Ed Warren.
 
Whenever you want to programmatically set the sort order or the filter
you also have to set that action on.

Example:

Private Sub Form_Open(Cancel As Integer)
Me.OrderBy = "[datetimecreated] DESC"
Me.OrderByOn = true
End Sub
 
Back
Top