Sort subform

  • Thread starter Thread starter DS NTE
  • Start date Start date
D

DS NTE

Hello

Access 2000

I have a main form (frm_Avlesninger) with a subform (sbfrm_Registrering).
The subform has several fields: AvlestDato, AvlestTid and 5 other ones. The
recordsource of the subform is a Query which sorts the subform ascending by
date (AvlestDato).
I would like to have a button on the main form which when clicked sorts the
subform descending by date (AvlestDato).
How can I accomplish this ?


Happy New Year from Norway

Knut
 
Just set the OrderBy and OrderByOn properties for the subform. To do this,
you have to go through *form* property of the *subform* control. In the
following replace 'SubFormCtl' with the name of your subform control. Note
that this is not necessarily the same as the name of the form object that is
referenced in the ControlSource of the subform control. To be sure, open the
main form and click once on the subform then check the name property under
the Other tab. Whatever you find there is what belongs in place of
SubFormCtl.

me.subFormCtl.form.orderby="AvlestDato Desc"
me.subFormCtl.form.orderbyOn=True
 
Thank you....
Works perfectly !

Knut


Sandra Daigle said:
Just set the OrderBy and OrderByOn properties for the subform. To do this,
you have to go through *form* property of the *subform* control. In the
following replace 'SubFormCtl' with the name of your subform control. Note
that this is not necessarily the same as the name of the form object that is
referenced in the ControlSource of the subform control. To be sure, open the
main form and click once on the subform then check the name property under
the Other tab. Whatever you find there is what belongs in place of
SubFormCtl.

me.subFormCtl.form.orderby="AvlestDato Desc"
me.subFormCtl.form.orderbyOn=True

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


DS said:
Hello

Access 2000

I have a main form (frm_Avlesninger) with a subform
(sbfrm_Registrering). The subform has several fields: AvlestDato,
AvlestTid and 5 other ones. The recordsource of the subform is a
Query which sorts the subform ascending by date (AvlestDato).
I would like to have a button on the main form which when clicked
sorts the subform descending by date (AvlestDato).
How can I accomplish this ?


Happy New Year from Norway

Knut
 
Back
Top