Order By Property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that uses a query to sort a table so the records are in the
proper order. I have tried to hard code the 'Order By' property to "[Contest
ID]" but the 'Order by' property field is blank the next time I open the
form. Why?

One solution is to set the 'Order by' field in the query but that is just
one more query I have to keep track of.

Steve
 
I have a form that uses a query to sort a table so the records are in the
proper order. I have tried to hard code the 'Order By' property to "[Contest
ID]" but the 'Order by' property field is blank the next time I open the
form. Why?

That's a design change to the form; you need to explicitly save the
form (Ctrl-S for example). You may need to also set the Form's
OrderByOn property to True (which can only be done in code).

John W. Vinson[MVP]
 
Yes the query is the recordsource for the form but it is just a query that
returns all the fields in the table but in the order I need in this instance.
all it does is sort in decending order. It would seem much simpler to use
the table as the record source and be able to set the sort order with the
OrderBy property.

Steve

Brian Bastl said:
Is this a stored query? Is it also the recordsource for your form?

Brian

Steve S said:
I have a form that uses a query to sort a table so the records are in the
proper order. I have tried to hard code the 'Order By' property to "[Contest
ID]" but the 'Order by' property field is blank the next time I open the
form. Why?

One solution is to set the 'Order by' field in the query but that is just
one more query I have to keep track of.

Steve
 
That is the answer. It sem that once I have set the OrderByOn to true I can
remove that code and never execute it again but can still set the OrderBy
property on the property sheet and it stays until I change it again.

Strange that this property can only be changed in code. I think that on a
report you can set the OrderByOn in th eproperty sheet.

thanks again

steve

John Vinson said:
I have a form that uses a query to sort a table so the records are in the
proper order. I have tried to hard code the 'Order By' property to "[Contest
ID]" but the 'Order by' property field is blank the next time I open the
form. Why?

That's a design change to the form; you need to explicitly save the
form (Ctrl-S for example). You may need to also set the Form's
OrderByOn property to True (which can only be done in code).

John W. Vinson[MVP]
 
Back
Top