Set order by table property with VBA

M

Marshall Barton

Del said:
What code can I use to set and clear the Order By property of my table?


I don't think there is such a publicly available property.
Why do you care? you should not be using a table's
datasheet view for anything that cares about how a *table*
is sorted. If you want to display sorted data, you should
use a query.
 
D

Del

The MS VB Help topic 'OrderBy Property' states the following: "You can use
the OrderBy property to specify how you want to sort records in a form,
query, report, or table."

I was simply wondering how I could use this property.
 
M

Marshall Barton

Del said:
The MS VB Help topic 'OrderBy Property' states the following: "You can use
the OrderBy property to specify how you want to sort records in a form,
query, report, or table."

I was simply wondering how I could use this property.


It's not a very useful property.

Setting the property in a table's design view just means it
will be saved with the table so you can turn it on or off
using the Records - Apply Filter/Sort menu item.

In the Query design view, you would specify the sort order
using a field's Sort "cell". In SQL view, you use the Order
By clause. After the query is opened in datasheet view, you
can override that by using the Filter/Sort menu item, which
sets the OrderBy *property*. This temporary sorting can
then be turned on/off using Apply Filter/Sort. Personally,
I think this feature may be marginally useful when debugging
data.

For real user interactions, you should always use a form. A
form's OrderBy property is publicly available and can be set
using the menu or in VBA code. (The property is turned
on/off via the menu or the OrderByOn property.)

Reports are a different kind of critter. Sorting in a
report is primarily specified using the Sorting and Grouping
window (View menu). The OrderBy property is only applied
after that and is near useless.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top