![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
SELECT TBL_Timers.TimerID, TBL_Timers.TimerPos FROM TBL_Timers order by SortStr(); |
#3
| |||
| |||
|
|
On 8 Apr., 03:54, Patrick A wrote: SELECT TBL_Timers.TimerID, TBL_Timers.TimerPos FROM TBL_Timers order by SortStr(); I expect this not to work because SortStr() is not a field in the table and if it were its result would be the same for all records. What you'd like is to put the two strings together: aQuery= "SELECT TimerID, TimerPos FROM TBL_Timers order by " + SortStr() to obtain aQuery= "SELECT TimerID, TimerPos FROM TBL_Timers order by TimerPos DESC" which of course is the way of doing this in VBA. No use if you don't want to work with VBA. Also: if you have already a variable or a function returning the "order by" fragment, the variable or the function can return the whole query just as easily and you can set it as a filter. But it is of no use if you have no forms nor reports. You could first run a query which fills a field with the right values: UPDATE tblTimers SET fldSort = iif(SortStr()="TimerPos",TimerPos, iif(SortStr="TimerID",TimerID, Null)) and then SELECT TimerID, TimerPos, fldSort FROM tblTimers order by fldSort but I cannot think of a way of processing DESC/ASC. Interesting, maybe someone else has an idea. Greetings Marco P |
![]() |
| Thread Tools | |
| Display Modes | |
| |