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

Order By 2

Status
Not open for further replies.

mrkshpntf

MIS
Apr 19, 2007
92
US

I have a MS-Access form which displays records.

I want the records to be displayed sequentially by date.

I added 'Date' the form's 'Order By' property but the form displays the records in the original order which is not by Date.

I have sorted the underlying table by date but there is no change.

Please suggest a solution.

Thanks,
mrkshpntf
 
I would be inclined to use SQL for the form's record source:

[tt]Select A, B, C, ADate From tblTable Order By ADate[/tt]

Alternatively, set the OrderBy and OrderByOn properties in the Open or Load event.
 


Remou,

Your suggestion worked perfectly.

Thanks,
mrkshpntf
 
I have been dynamically changing a form's record source in VBA to change the sort order. It seems like it would be easier to just use VBA to set the OrderBy property. How does it work? When I try:

Form_Data.OrderBy "OrderType DESC"

I receive an "Invalid Use of Property" error code.

Thanks in advance,
Jaaret
 
How about:

[tt]Me.OrderBy = "OrderType DESC"
Me.OrderByOn = True[/tt]
 
Oops - I take that back. I didn't have the equal sign in the first statement. That fixed it. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top