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

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
 
A

Allen Browne

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top