dbTalk Databases Forums  

Returning a Sort Criteria from a Form

comp.database.ms-access comp.database.ms-access


Discuss Returning a Sort Criteria from a Form in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
hoytnancy
 
Posts: n/a

Default Returning a Sort Criteria from a Form - 07-13-2004 , 09:38 AM






Hi There!

I have a distributed Access 2000 app in which I show the user their
data on a form and allow them to apply any sorting as they see fit
using the A-Z buttons. To report on the data I send a recordset out
to Excel. However, I like to apply the same sort order that the user
applied to his/her list while viewing/editing the form's data. To get
the sort order I use the code below. WHY, however, does the
SortCriteria come back with the table name in it (ie..,
tEquipmentList.RoomNo) with some users, but without the table name
(ie., RoomNo) for some users? Is there some sort of preferences set
in their Access 2000 app that I am unaware of???

Thanks alot!
Nancy

'_________________________________________________ ____________________
'if user has a sort order on, send data based on sort order
If Forms!fBackgroundForm!fSummaryEquipmentList.Form.O rderByOn
= True Then
SortCriteria =
Forms!fBackgroundForm!fSummaryEquipmentList.Form.O rderBy
'V1.11 if user has orderby explicitly naming table name
too
'(e.g., tEquipmentList.RoomNo is explicit versus RoomNo)
then parse
'table name out so can do lookup on field name mapping
generically
If InStr(SortCriteria, ".") > 0 Then
SortCriteria = Right(SortCriteria, Len(SortCriteria) -
InStr(SortCriteria, "."))
End If
'If there's a sort order and it is descending, parse out
the DESC
If Right(SortCriteria, 4) = "DESC" Then
OrderDescending = True
SortCriteria = Left(SortCriteria, Len(SortCriteria) -
5)
Else
OrderDescending = False
End If
end if

'_________________________________________________ _________

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.