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

Sorting Records in a Form 1

Status
Not open for further replies.

billmsacces

Programmer
Feb 2, 2004
16
0
0
US
I am currently working on a database that has a name field and date field. It is currently based on a query that sorts the records by name. But sometimes I would like to view the records by date. Is it possible to write a code that would resort the records by date?
It was suggested tome to use the Query by Form, but I can only get the QBF to show the results in a datasheet.
What I am more interested in is a way that I could simply sort the records by date if I needed or by name, by using a command button or something of the sort.
Thanks.
Bill
 
THis is very simple to do - on my site i have a sample that allows resorting and filtering on a continuous type form.

To save the expense, just place a button on your form with the following type of code (alter to fit your exact field names):

On Click:

with Me
.Orderby = &quot;[myDate]&quot; <-- your other field name here
.orderbyOn = True
.requery
end with

This should do you up just fine.


JMH



Don't be sexist - Broads hate that.
Another free Access forum:
More Access help stuff at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top