Use the toolbox wizard to add an option group named SortBy to your form.
Make option 1 Drawing# and option2 Title. Make a copy of your existing
query and give the two queries names of QrySortByDwgNo and QrySortByTitle.
Put the following code in the AfterUpdate event of the option group:
Select Case Me!SortBy
Case 1
Me.RecordSource = "QrySortByDwgNo"
Case 2
Me.RecordSource = "QrySortByTitle"
End Select
Me.Requery
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com www.pcdatasheet.com
"Pav^" <je**********@abc.net.au> wrote in message
news:d3**************************@posting.google.c om...
Greetings,
I have a form with a listbox on it which displays the result of a
query.
I need to be able to change the sort field (DwgNo or Title)on which
the sort is performed by selecting either a DwgNo button or a Title
button. Can I do this by changing the SQL query in code?
Thanks
Evan Pav^ Jenkins