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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a form's Order By property

Status
Not open for further replies.
Jan 22, 2001
124
US
I have a form based on a query in which 3 of the fields are sorted. The users must be able to do their own sorts also. The problem with this is that when a user does sort the records on his or her own, the Order By property of the form is populated. Now, each time the form is opened, the records are sorted based on the Order By property and not the original sort in the query. I need the original sort order of the query to be in effect each time this form is opened. Is there any way to not allow the Order By property to be populated? Is there a way to change this property using the Close event of the form? If so, please give me an example of the code using 3 sort fields. Any help would be greatly appreciated. Thanks in advance.

--Rob
 
I have a form that has a command button on it. The command changes requeries the record source and sorts as I choose with the following code in the command button's click event.

Me.RecordSource = "SELECT * FROM MYQUERY ORDER BY LASTNAME, FIRST NAME"

Whenever I open the form it is sorted by ID number. If I hit the button it goes to lastname firstname order.

B-)

ljprodev@yahoo.com
ProDev
MS Access Applications
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top