how to order a sub form

Jackske

Registered User.
Local time
Today, 08:48
Joined
Feb 28, 2000
Messages
48
I have a form (Members of the club), linked to a sub form (payments of membership).

When I open the record of Mr John, I want to see all his payments order by date of payment.

How do I do?

Thanks in advance,

Jackske - Belgium
:confused:
 
sub-form order

Select the form view of the sub-form in design mode. Now click on Data, third line down is Order By. Put your field in there and you should be all set.
 
Strange no?

Dear Thread,
Thanks for your good will but I did not solve my problem.
I did put a filter in the properties of my form (MemberNr=320) and I did put an order in the properties of my sub-form (OrderBy = date_of_payement).
The strange thing is that when I open my form, I get the record of Member 320 but the payments are NOT order by date_of_payement. If I switch of design mode and directly again to form view; everything is perfect. The payments of Member 320 are order by date_of_payement.
Strange no?
 
I got the solution

I did find on a google forum the solution of my problem.
You have to define all in the main form.
Here is the solution

Set the OrderBy (and set OrderByOn to true) for the subform in the
OnOpen or OnCurrent event of the main form. Something like:


Me![name of subform control].form.OrderBy = "field you want to sort on"
Me![name of subform control].form.OrderByOn = True
 
The easiest and most efficient thing is to simply use an Orderby clause in the subform's RecordSource query.
 
Thanks Pat but this is not working.
I did find the solution on a google forum.
You have to define the orderby of the sub-form in the main form.

Set the OrderBy (and set OrderByOn to true) for the subform in the
OnOpen or OnCurrent event of the main form. Something like:


Me![name of subform control].form.OrderBy = "field you want to sort on"
Me![name of subform control].form.OrderByOn = True
 
If it is not working for you then you have not implemented it properly. That is the way all my subforms and forms are ordered.

If you want to change the order of the subform records after the subform opens, you can do it by using the method you posted or you can do it by replacing the subform's RecordSource and requerying the subform.
 

Users who are viewing this thread

Back
Top Bottom