ORDER BY (?)

A

an

Hello!

I have a MainForm based in T_S, with IdS field and others.
In MainForm, one combobox sfter click, open a SubFormQ, based in T_Q, with
IdS in Link Chield Fields and Link Master Fields.
I would like to order records in SubFormQ, for Q field.
Already tried to order for Q field with [Q] ASC in Order By in SubFormQ, but
don't work.

Thanks in advance.
an
 
A

Allen Browne

As well as setting the OrderBy property you also need to turn OrderByOn.

Example, using the Open event of the subform:

Private Sub Form_Open(Cancel As Integer)
Me.OrderBy = "Q"
Me.OrderByOn = True
End Sub

It might be easier to create a query that sorts by Q, and use it as the
RecordSource of your subform.
 
A

an

AB,

Thank you for your solution.
Work fine.
an

Allen Browne said:
As well as setting the OrderBy property you also need to turn OrderByOn.

Example, using the Open event of the subform:

Private Sub Form_Open(Cancel As Integer)
Me.OrderBy = "Q"
Me.OrderByOn = True
End Sub

It might be easier to create a query that sorts by Q, and use it as the
RecordSource of your subform.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

an said:
I have a MainForm based in T_S, with IdS field and others.
In MainForm, one combobox sfter click, open a SubFormQ, based in T_Q, with
IdS in Link Chield Fields and Link Master Fields.
I would like to order records in SubFormQ, for Q field.
Already tried to order for Q field with [Q] ASC in Order By in SubFormQ,
but
don't work.

Thanks in advance.
an
 
Top