Problem setting the order of records in a subform....

  • Thread starter Thread starter gribbles
  • Start date Start date
G

gribbles

I have set up a simple form with a subform. The main form is nothing
more than a container for the subform (there is no parent/child data
link), and the subform is simply a datasheet view of a form getting it's
data from a query.

The query AND subform record order has been set to sort ascending on a
date field. When you view the query and the subform itself, the records
are sorted correctly.

However, when you view the subform in the main form, it reverts to
sorting on the primary key.

I know this is probably one of those really obvious things, but I can't
seem to crack it and it's starting to bug me :)

Anyone got any suggestions?

TIA,

Graham
 
If the subform is not respecting the order in the query, you could use its
Open event to set its OrderBy property:

Private Sub Form_Open(Cancel As Integer)
Me.OrderBy = "[NameOfYourDateFieldHere]"
Me.OrderBy = True
End Sub
 
Back
Top