OrberBy

  • Thread starter Thread starter Jess
  • Start date Start date
J

Jess

Hi!
I'm trying to get my site visit records to show up
automatically with the latest visits first (in forms), and
to retain this sort after the records for one site are
filtered. I've tried using the OrderBy property, but it
doesn't seem to be working. [Date] DESC hasn't been
working, even after Access reformats it. I tried OrderByOn
= True in the Form Load code, but that broke all my
filters. Any suggestions?

-Jess
 
Jess said:
Hi!
I'm trying to get my site visit records to show up
automatically with the latest visits first (in forms), and
to retain this sort after the records for one site are
filtered. I've tried using the OrderBy property, but it
doesn't seem to be working. [Date] DESC hasn't been
working, even after Access reformats it. I tried OrderByOn
= True in the Form Load code, but that broke all my
filters. Any suggestions?

-Jess

Base your form on a query -- whether a stored query or an SQL
statement -- that sorts the records in the sequence you want. In other
words, apply the ORDER BY clause in the query, rather than setting the
Order By property of the form.

If you don't want to do it that way, you could put code in the form's
Open event that sets both the Order By property and the OrderByOn
property.

It may be that you're having problems because your field is named
"Date", and that may be confused with the Date function. If that's the
case, try specifying it in the form "TableName.Date", where "TableName"
is the name of the source table (or query) that contains the field.
 
Basing the form from a query worked great! Thanks!

-Jess
-----Original Message-----
Hi!
I'm trying to get my site visit records to show up
automatically with the latest visits first (in forms), and
to retain this sort after the records for one site are
filtered. I've tried using the OrderBy property, but it
doesn't seem to be working. [Date] DESC hasn't been
working, even after Access reformats it. I tried OrderByOn
= True in the Form Load code, but that broke all my
filters. Any suggestions?

-Jess

Base your form on a query -- whether a stored query or an SQL
statement -- that sorts the records in the sequence you want. In other
words, apply the ORDER BY clause in the query, rather than setting the
Order By property of the form.

If you don't want to do it that way, you could put code in the form's
Open event that sets both the Order By property and the OrderByOn
property.

It may be that you're having problems because your field is named
"Date", and that may be confused with the Date function. If that's the
case, try specifying it in the form "TableName.Date", where "TableName"
is the name of the source table (or query) that contains the field.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Back
Top