Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display a First Record First (Alphabetically) 1

Status
Not open for further replies.

DougAtAvalon

Programmer
Jan 29, 2001
99
US
When I open a form how do I make it go to the first record sorted Alphabetically without changing the record source from the table name?

-Doug
 
Dear Doug:
This has worked for me:
In the property sheet for the form when you select the Data tab, there is a row called "Order By". Put your cursor in that field and press F1. You should get the following info from "help".
The OrderBy property is a string expression that is the name of the field or fields on which you want to sort records. When you use more than one field name, separate the names with a comma (,).

When you set the OrderBy property by entering one or more field names, the records are sorted in ascending order. Similarly, Visual Basic sorts these fields in ascending order by default.

If you want to sort records in descending order, type DESC at the end of the string expression. For example, to sort customer records in descending order by contact name, set the OrderBy property to "ContactName DESC".

You can set the OrderBy property by using the object's property sheet, a macro, or Visual Basic.


So, in the row "Order by" just enter the name of the field that will govern the way your records appear.

(If no record shows up, then put this in the Default Value of the property sheet of the control itself:
[TheNameOfControl].[ItemData](0)
Works for me. Good luck
:cool:

Gus Brunston
An old PICKer
padregus@home.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top