okay, scrap the SQL statement i posted previously.
open a standard module (in the database window: Modules tab, New) and paste
the following function into it, as
Public Function isGetAlphas(ByVal str As String)
Dim i As Integer, cnt As Integer, strA As String
i = Len(str)
For cnt = 1 To i
If IsNumeric(Mid(str, cnt, 1)) = False Then
isGetAlphas = Left(str, cnt)
Else
Exit For
End If
Next
End Function
save and close, and make sure you do NOT name the module with the same name
as the function.
paste the following SQL statement into the SQL pane of a new query, as
SELECT isGetAlphas([Comp Part]) AS SortA, IIf(Asc(Left([Comp
Part],1))<65,CLng([Comp Part]),Len(IIf(InStr(1,[Comp Part],"-")=0,[Comp
Part],Left([Comp Part],InStr(1,[Comp Part],"-")-1)))) AS SortB,
Table13.[Comp Part]
FROM Part
ORDER BY isGetAlphas([Comp Part]), IIf(Asc(Left([Comp
Part],1))<65,CLng([Comp Part]),Len(IIf(InStr(1,[Comp Part],"-")=0,[Comp
Part],Left([Comp Part],InStr(1,[Comp Part],"-")-1)))), [Comp Part];
if the sort order fits your needs, then include the two calculated fields in
the
"real" query that the report is based on. in the *report*, sort the data by
fields SortA, SortB, and [Comp Part], in that order. (note: don't bother
sorting the fields at the query level at all, it's the report level sort
that will "stick".)
hth
Tom said:
Tina,
Here is another example of the sort not being what I need.
The sort should begin with the ATD2 through ATD1000+, then go to the PGD
numbers and finally the SGD numbers, all in chronological order.
Thanks
Comp Part
PGD2
PGD4
PGD8
PGD9
SGD8
PGD11
PGD1R
PGD21
PGD27
PGD2M
PGD32
PGD37
PGD3R
PGD42
PGD44
PGD45
PGD48
PGD51
PGD54
PGD56
PGD59
PGD61
PGD71
PGD76
PGD77
PGD82
PGD8R
PGD96
PGD97
PGD99
PGD9M
SGD11
SGD14
SGD21
SGD27
SGD33
SGD36
SGD37
SGD42
SGD44
SGD45
SGD48
SGD56
SGD76
SGD9M
ATD50M
ATD52C
ATD52M
PGD100
PGD101
PGD104
PGD110
PGD112
PGD114
PGD117
PGD118
PGD130
PGD131
PGD132
PGD134
PGD135
PGD136
PGD137
PGD139
PGD141
PGD144
PGD145
PGD146
PGD147
PGD148
PGD14R
PGD156
PGD157
PGD158
PGD163
PGD164
PGD166
PGD169
PGD174
PGD175
PGD176
PGD177
PGD178
PGD180
PGD185
PGD186
PGD187
PGD188
PGD189
PGD193
PGD194
PGD195
PGD196
PGD197
PGD198
PGD200
PGD201
PGD204
PGD207
PGD20R
PGD212
PGD213
PGD223
PGD227
PGD228
PGD229
PGD230
PGD231
PGD233
PGD234
PGD235
PGD239
PGD242
PGD243
PGD244
PGD246
PGD247
PGD250
PGD251
PGD254
PGD255
PGD258
PGD260
PGD263
PGD265
PGD266
PGD272
PGD273
PGD274
PGD275
PGD277
PGD281
PGD285
PGD288
PGD290
PGD292
PGD293
PGD297
PGD299
PGD300
PGD301
PGD303
PGD305
PGD306
PGD309
PGD30A
PGD311
PGD314
PGD323
PGD325
PGD328
PGD329
PGD330
PGD331
PGD332
PGD336
PGD337
PGD339
PGD33R
PGD340
PGD342
PGD345
PGD349
PGD350
PGD351
PGD352
PGD355
PGD356
PGD361
PGD363
PGD364
PGD365
PGD366
PGD36R
PGD374
PGD383
PGD384
PGD389
PGD38M
PGD38R
PGD390
PGD398
PGD399
PGD39M
PGD39R
PGD400
PGD409
PGD410
PGD415
PGD418
PGD422
PGD434
PGD436
PGD437
PGD43A
PGD440
PGD443
PGD445
PGD448
PGD451
PGD458
PGD45A
PGD462
PGD463
PGD465
PGD468
PGD470
PGD471
PGD476
PGD477
PGD481
PGD482
PGD484
PGD488
PGD490
PGD500
PGD501
PGD502
PGD503
PGD504
PGD50M
PGD50R
PGD510
PGD511
PGD515
PGD527
PGD528
PGD52C
PGD52M
PGD52R
PGD530
PGD531
PGD532
PGD534
PGD536
PGD537
PGD540
PGD549
PGD54A
PGD54B
PGD551
PGD552
PGD553
PGD556
PGD562
PGD563
PGD567
PGD568
PGD571
PGD572
PGD573
PGD576
PGD579
PGD57A
PGD580
PGD583
PGD584
PGD587
PGD588
PGD595
PGD596
PGD598
PGD600
PGD601
PGD602
PGD604
PGD611
PGD612
PGD613
PGD617
PGD619
PGD621
PGD622
PGD627
PGD631
PGD635
PGD636
PGD637
PGD642
PGD643
PGD653
PGD657
PGD661
PGD665
PGD666
PGD668
PGD669
PGD672
PGD677
PGD680
PGD685
PGD691
PGD697
PGD698
PGD699
PGD700
PGD707
PGD714
PGD716
PGD721
PGD722
PGD723
PGD724
PGD726
PGD727
PGD729
PGD730
PGD741
PGD750
PGD754
PGD755
PGD771
PGD772
PGD773
PGD775
PGD787
PGD793
PGD798
PGD811
PGD813
PGD815
PGD817
PGD822
PGD823
PGD828
PGD829
PGD830
PGD831
PGD832
PGD835
PGD84M
PGD84R
PGD855
PGD862
PGD864
PGD865
PGD867
PGD868
PGD871
PGD87M
PGD87R
PGD885
PGD887
PGD892
PGD90M
PGD90R
PGD913
PGD91M
PGD91R
PGD925
PGD92M
PGD92R
PGD96A
PGD96M
SGD102
SGD112
SGD114
SGD117
SGD122
SGD132
SGD134
SGD139
SGD141
SGD144
SGD146
SGD156
SGD157
SGD163
SGD164
SGD166
SGD169
SGD174
SGD175
SGD176
SGD177
SGD178
SGD180
SGD187
SGD194
SGD196
SGD197
SGD204
SGD20M
SGD213
SGD223
SGD229
SGD230
SGD231
SGD233
SGD235
SGD239
SGD243
SGD246
SGD247
SGD265
SGD277
SGD285
SGD293
SGD300
SGD301
SGD305
SGD309
SGD30A
SGD314
SGD339
SGD342
SGD347
SGD350
SGD351
SGD352
SGD361
SGD364
SGD365
SGD366
SGD38M
SGD398
SGD39M
SGD400
SGD445
SGD45A
SGD463
SGD468
SGD488
SGD490
SGD50M
SGD515
SGD52M
SGD54A
SGD57A
SGD595
SGD622
SGD84M
SGD87M
SGD90M
SGD91M
SGD92M
SGD96M
ATD120M
ATD149M
ATD154C
ATD154M
ATD184M
ATD215M
ATD224M
ATD225M
ATD236M
ATD242C
ATD249C
ATD249M
ATD269C
ATD269M
ATD273C
ATD325C
ATD333C
ATD334C
ATD368M
ATD369C
ATD369M
ATD370C
ATD370M
ATD374C
ATD375C
ATD375M
ATD376C
ATD383C
ATD396C
ATD409C
ATD411M
ATD450M
ATD459C
ATD459M
ATD465C
ATD470C
ATD471C
ATD473C
ATD476C
ATD477C
ATD477M
ATD484C
ATD503C
ATD505C
ATD506C
ATD507C
ATD508C
ATD522C
ATD524C
ATD530C
ATD536C
ATD537C
ATD540C
ATD551C
ATD557M
ATD558C
ATD562C
ATD576C
ATD579C
ATD580C
ATD588C
ATD598C
ATD600C
ATD601C
ATD610C
ATD617C
ATD618C
ATD623C
ATD627C
ATD632C
ATD632M
ATD637C
ATD648C
ATD650C
ATD652C
ATD652M
ATD653C
ATD655M
ATD659C
ATD659P
ATD666C
ATD667C
ATD668C
ATD674C
ATD674M
ATD674P
ATD679C
ATD679M
ATD691C
ATD697C
ATD698C
ATD698P
ATD699C
ATD699P
ATD701M
ATD702C
ATD702M
ATD707C
ATD711C
ATD711M
ATD714C
ATD721C
ATD723C
ATD726C
ATD727C
ATD729C
ATD730C
ATD730M
ATD731C
ATD732C
ATD734M
ATD735M
ATD741C
ATD746C
ATD748C
ATD748M
ATD748P
ATD749C
ATD754C
ATD757C
ATD757M
ATD758C
ATD758M
ATD760C
ATD769M
ATD771C
ATD774C
ATD777M
ATD784C
ATD785C
ATD785P
ATD786M
ATD788M
ATD790C
ATD791C
ATD792C
ATD793C
ATD799C
ATD802M
ATD803C
ATD804C
ATD805C
ATD806C
ATD812C
ATD816C
ATD820C
ATD820M
ATD821M
ATD824C
ATD824M
ATD828C
ATD830C
ATD833C
ATD834C
ATD841C
ATD842M
ATD843C
ATD844C
ATD855C
ATD856C
ATD865C
ATD866C
ATD881C
ATD882C
ATD883C
ATD898M
ATD905C
ATD908C
ATD909C
ATD913C
ATD914C
ATD921C
ATD922C
ATD923C
ATD928M
ATD931C
ATD931M
ATD931P
ATD932C
ATD932P
ATD934C
ATD935C
ATD949M
ATD950M
ATD959C
ATD966M
ATD969C
ATD974C
ATD976C
ATD999C
PGD1004
PGD101M
PGD102R
PGD110M
PGD119M
PGD120M
PGD120R
PGD122R
PGD123M
PGD123R
PGD130M
PGD131M
PGD133M
PGD135M
PGD136A
PGD136M
PGD137M
PGD139H
PGD142M
PGD145A
PGD145M
PGD147A
PGD147M
PGD149M
PGD149R
PGD150M
PGD150R
PGD151M
PGD151R
PGD152M
PGD152R
PGD153M
PGD153R
PGD154C
PGD154M
PGD154R
PGD158M
PGD170M
PGD179R
PGD183H
PGD183M
PGD184M
PGD188M
PGD189M
PGD190M
PGD191M
PGD195M
PGD199M
PGD199R
PGD200M
PGD202M
PGD202R
PGD203H
PGD203M
PGD207M
PGD214M
PGD215M
PGD218M
PGD219M
PGD220M
PGD221M
PGD224M
PGD225M
PGD227A
PGD227M
PGD228M
PGD236M
PGD240M
PGD242C
PGD242M
PGD245M
PGD249C
PGD249M
PGD255M
PGD256C
PGD256M
PGD257M
PGD257R
PGD258M
PGD259M
PGD261M
PGD262M
PGD263M
PGD264M
PGD266M
PGD269M
PGD270M
PGD272M
PGD273C
PGD273M
PGD274M
PGD275M
PGD276M
PGD278M
PGD279M
PGD280A
PGD280B
PGD280C
PGD280M
PGD281M
PGD282M
PGD284M
PGD289M
PGD290M
PGD291M
PGD294M
PGD295M
PGD296M
PGD297M
PGD298M
PGD299M
PGD303M
PGD306M
PGD307M
PGD308M
PGD310H
PGD310M
PGD311C
PGD311M
PGD312M
PGD317M
PGD319M
PGD31BM
PGD320M
PGD321M
PGD322M
PGD323A
PGD323M
PGD324M
PGD325C
PGD325M
PGD326M
PGD328M
PGD329C
PGD329M
PGD331M
PGD332C
PGD333C
PGD333M
PGD334M
PGD335M
PGD336C
PGD338M
PGD340A
PGD340M
PGD342M
PGD343R
PGD344M
PGD346M
PGD347R
PGD348M
PGD349C
PGD353M
PGD354M
PGD356C
PGD356M
PGD357M
PGD358M
PGD359M
PGD363C
PGD363M
PGD365M
PGD367M
PGD368M
PGD369C
PGD369M
PGD370C
PGD370M
PGD373M
PGD374C
PGD374M
PGD375M
PGD376C
PGD376M
PGD377M
PGD378M
PGD379M
PGD381M
PGD382M
PGD383C
PGD383M
PGD385M
PGD386M
PGD388M
PGD389C
PGD389M
PGD390M
PGD391M
PGD393M
PGD394M
PGD395M
PGD396M
PGD397M
PGD398M
PGD399C
PGD399M
PGD400M
PGD401M
PGD402M
PGD403M
PGD405M
PGD406M
PGD407M
PGD408M
PGD409C
PGD409M
PGD410C
PGD411M
PGD412M
PGD413M
PGD414M
PGD415M
PGD417M
PGD417R
PGD418C
PGD418M
PGD419M
PGD420M
PGD421M
PGD422C
PGD422M
PGD423M
PGD424M
PGD425M
PGD427M
PGD428M
PGD431M
PGD433A
PGD434M
PGD436A
PGD436C
PGD436M
PGD43AM
PGD440M
PGD450M
PGD451C
PGD451M
PGD453M
PGD454M
PGD456M
PGD458C
PGD458M
PGD459M
PGD460M
PGD461M
PGD462C
PGD462M
PGD465A
PGD465C
PGD465M
PGD466M
PGD468M
PGD470C
PGD470M
PGD471C
PGD471M
PGD472M
PGD473C
PGD473M
PGD475M
PGD476C
PGD476M
PGD477C
PGD477M
PGD478M
PGD479M
PGD480M
PGD481M
PGD482C
PGD484C
PGD484M
PGD486C
PGD486M
PGD489M
PGD491M
PGD492M
PGD493M
PGD496C
PGD496M
PGD498C
PGD498M
PGD499R
PGD500M
PGD501C
PGD502C
PGD502M
PGD503C
PGD503M
PGD505M
PGD506C
PGD506M
PGD507C
PGD507M
PGD508M
PGD509M
PGD510M
PGD517M
PGD518M
PGD519M
PGD520M
PGD522M
PGD523M
PGD524M
PGD525M
PGD527M
PGD529M
PGD52QS
PGD530C
PGD530M
PGD531C
PGD532C
PGD534C
PGD535M
PGD536C
PGD537C
PGD537M
PGD538M
PGD540C
PGD540M
PGD541M
PGD542M
PGD544R
PGD546M
PGD547M
PGD548M
PGD550M
PGD551C
PGD551M
PGD552M
PGD553C
PGD553M
PGD555M
PGD556C
PGD556M
PGD557M
PGD558M
PGD561M
PGD562C
PGD562M
PGD563C
PGD563M
PGD566M
PGD567C
PGD567M
PGD568C
PGD568M
PGD572C
PGD572M
PGD576C
PGD576M
PGD578M
PGD579C
PGD580A
PGD580C
PGD580M
PGD581M
PGD582M
PGD583C
PGD583M
PGD584C
PGD584M
PGD587C
PGD587M
PGD588C
PGD588M
PGD590M
PGD591C
PGD591M
PGD592M
PGD598C
PGD598M
PGD599R
PGD600C
PGD600M
PGD601C
PGD601M
PGD602C
PGD602M
PGD603M
PGD604C
PGD604M
PGD606C
PGD606M
PGD608M
PGD609M
PGD610C
PGD610R
PGD611C
PGD611M
PGD612C
PGD612M
PGD613C
PGD614M
PGD617C
PGD617M
PGD618M
PGD619C
PGD619M
PGD620M
PGD621C
PGD621M
PGD623C
PGD623M
PGD625M
PGD627C
PGD628M
PGD629M
PGD630M
PGD632C
PGD632M
PGD633M
PGD634M
PGD635C
PGD635M
PGD636C
PGD636M
PGD637C
PGD637M
PGD638M
PGD639M
PGD640M
PGD641M
PGD641R
PGD642M
PGD643C
PGD644M
PGD645M
PGD647M
PGD648M
PGD649M
PGD650C
PGD650M
PGD651M
PGD652M
PGD653C
PGD653M
PGD655M
PGD658R
PGD659M
PGD660M
PGD661M
PGD662M
PGD664M
PGD665C
PGD665M
PGD666C
PGD666M
PGD667M
PGD668C
PGD668M
PGD669C
PGD670M
PGD672C
PGD672M
PGD674A
PGD674M
PGD676M
PGD677C
PGD679C
PGD679M
PGD680C
PGD681M
PGD682M
PGD683M
PGD684M
PGD685C
PGD687M
PGD688M
PGD689C
PGD689M
PGD691C
PGD694M
PGD697C
PGD697M
PGD698C
PGD699C
PGD699M
PGD700C
PGD700M
PGD702C
PGD702M
PGD703M
PGD704M
PGD706M
PGD707C
PGD707M
PGD708M
PGD709A
PGD709M
PGD710M
PGD711C
PGD711M
PGD714C
PGD714M
PGD715M
PGD716C
PGD720M
PGD721C
PGD721M
PGD722C
PGD722M
PGD723C
PGD724C
PGD725M
PGD726C
PGD727C
PGD729C
PGD730A
PGD730C
PGD730M
PGD731C
PGD731M
PGD732C
PGD732M
PGD733M
PGD736M
PGD739M
PGD741C
PGD741M
PGD746M
PGD748C
PGD748M
PGD749C
PGD749M
PGD750C
PGD751M
PGD753M
PGD754M
PGD755C
PGD757M
PGD758M
PGD759M
PGD760M
PGD761M
PGD762M
PGD763M
PGD768M
PGD769M
PGD770C
PGD770M
PGD771C
PGD772C
PGD773C
PGD774M
PGD777M
PGD779M
PGD780M
PGD781M
PGD782M
PGD783M
PGD784C
PGD784M
PGD785C
PGD785M
PGD786M
PGD787C
PGD787M
PGD790C
PGD790M
PGD791M
PGD792C
PGD792M
PGD793C
PGD794M
PGD795M
PGD796M
PGD797M
PGD798C
PGD798M
PGD799C
PGD799M
PGD800M
PGD801M
PGD802M
PGD803M
PGD804C
PGD804M
PGD805M
PGD806C
PGD806M
PGD808M
PGD812C
PGD812M
PGD813C
PGD815C
PGD815M
PGD816C
PGD816M
PGD817C
PGD819M
PGD820M
PGD821M
PGD822C
PGD822M
PGD823C
PGD824M
PGD828C
PGD829C
PGD830C
PGD830M
PGD831C
PGD832C
PGD833C
PGD833M
PGD834C
PGD834M
PGD835C
PGD837M
PGD838M
PGD839M
PGD840M
PGD841M
PGD842M
PGD843C
PGD843M
PGD844M
PGD847M
PGD848M
PGD853M
PGD855C
PGD856M
PGD857M
PGD858M
PGD862C
PGD864C
PGD864M
PGD865C
PGD866C
PGD866M
PGD867C
PGD868C
PGD869M
PGD870C
PGD870M
PGD871C
PGD872M
PGD873M
PGD874M
PGD875M
PGD881C
PGD881M
PGD882C
PGD882M
PGD883C
PGD883M
PGD884C
PGD884M
PGD885C
PGD886M
PGD887C
PGD888C
PGD888M
PGD889C
PGD889M
PGD890C
PGD890M
PGD891M
PGD892C
PGD893C
PGD893M
PGD897M
PGD898M
PGD899M
PGD900C
PGD900M
PGD901M
PGD902M
PGD904M
PGD905C
PGD905M
PGD906C
PGD906M
PGD908C
PGD908M
PGD909C
PGD909M
PGD910M
PGD911M
PGD912M
PGD913C
PGD914C
PGD914M
PGD915M
PGD918M
PGD920M
PGD921C
PGD921M
PGD922C
PGD922M
PGD923C
PGD923M
PGD924C
PGD924M
PGD925C
PGD926M
PGD929C
PGD929M
PGD930C
PGD930M
PGD931C
PGD931M
PGD932C
PGD932M
PGD933M
PGD934M
PGD935M
PGD937M
PGD938M
PGD939M
PGD940M
PGD941C
PGD941M
PGD943C
PGD943M
PGD944C
PGD944M
PGD945M
PGD946M
PGD947M
PGD948M
PGD952M
PGD953C
PGD953M
PGD954C
PGD954M
PGD955C
PGD955M
PGD956C
PGD956M
PGD957C
PGD957M
PGD959C
PGD959M
PGD960M
PGD961M
PGD962M
PGD963M
PGD964C
PGD964M
PGD965M
PGD966M
PGD967M
PGD969C
PGD969M
PGD96QS
PGD970M
PGD972M
PGD973C
PGD973M
PGD974C
PGD974M
PGD976C
PGD976M
PGD978M
PGD979M
PGD980M
PGD981C
PGD981M
PGD982M
PGD985M
PGD986M
PGD988C
PGD988M
PGD989C
PGD989M
PGD992M
PGD995C
PGD995M
PGD996C
PGD996M
PGD997C
PGD997M
PGD998C
PGD998M
PGD999C
PGD999M
SGD101M
SGD120M
SGD130M
SGD131M
SGD135M
SGD136A
SGD136M
SGD137M
SGD142M
SGD145M
SGD147A
SGD147M
SGD149M
SGD150M
SGD151M
SGD152M
SGD153M
SGD154M
SGD158M
SGD170M
SGD179M
SGD183M
SGD188M
SGD189M
SGD191M
SGD195M
SGD199M
SGD200M
SGD202M
SGD203M
SGD207M
SGD214M
SGD215M
SGD218M
SGD219M
SGD220M
SGD221M
SGD227M
SGD228M
SGD240M
SGD242M
SGD245M
SGD249M
SGD255M
SGD256C
SGD257M
SGD258M
SGD259M
SGD261M
SGD262M
SGD263M
SGD264M
SGD266M
SGD269M
SGD270M
SGD272M
SGD273C
SGD274M
SGD275M
SGD276M
SGD278M
SGD279M
SGD280M
SGD281M
SGD282M
SGD284M
SGD289M
SGD290M
SGD291M
SGD294M
SGD295M
SGD296M
SGD297M
SGD299M
SGD303M
SGD306M
SGD307M
SGD308M
SGD310M
SGD311C
SGD317M
SGD319M
SGD31BM
SGD320M
SGD322M
SGD323M
SGD325C
SGD326M
SGD328M
SGD329C
SGD331C
SGD332C
SGD333M
SGD334M
SGD335M
SGD336C
SGD338M
SGD340M
SGD344M
SGD348M
SGD349C
SGD353M
SGD354M
SGD356M
SGD357M
SGD358M
SGD359M
SGD363C
SGD367M
SGD368M
SGD369M
SGD370M
SGD373M
SGD374C
SGD375M
SGD376M
SGD377M
SGD378M
SGD381M
SGD382M
SGD383C
SGD385M
SGD386M
SGD388M
SGD389C
SGD390M
SGD391M
SGD393M
SGD394M
SGD395M
SGD396M
SGD397M
SGD399M
SGD401M
SGD402M
SGD403M
SGD409M
SGD410C
SGD412M
SGD413M
SGD414M
SGD415M
SGD417M
SGD418C
SGD419M
SGD420M
SGD421M
SGD422M
SGD423M
SGD424M
SGD427M
SGD428M
SGD431M
SGD434M
SGD436C
SGD43AM
SGD440M
SGD450M
SGD451M
SGD456M
SGD458C
SGD459M
SGD460M
SGD461M
SGD462C
SGD465C
SGD466M
SGD470M
SGD471M
SGD473M
SGD475M
SGD476C
SGD477M
SGD478M
SGD479M
SGD480M
SGD481M
SGD482C
SGD484C
SGD486M
SGD489M
SGD491M
SGD492M
SGD493M
SGD496C
SGD498M
SGD500M
SGD501C
SGD502M
SGD503C
SGD505M
SGD506M
SGD507C
SGD508M
SGD509M
SGD510M
SGD511C
SGD517M
SGD522M
SGD523M
SGD524M
SGD525M
SGD527C
SGD528C
SGD529M
SGD530C
SGD531C
SGD532C
SGD534C
SGD535M
SGD536C
SGD537C
SGD538M
SGD540C
SGD541M
SGD542M
SGD549C
SGD550M
SGD551C
SGD552C
SGD553C
SGD555M
SGD556C
SGD557M
SGD558M
SGD561M
SGD562C
SGD563C
SGD566M
SGD567C
SGD568C
SGD571C
SGD572C
SGD576C
SGD579C
SGD580C
SGD582M
SGD583C
SGD584C
SGD587C
SGD588C
SGD598C
SGD600C
SGD601C
SGD601M
SGD602C
SGD603M
SGD604C
SGD606C
SGD610C
SGD611C
SGD612C
SGD613C
SGD614M
SGD617C
SGD618M
SGD619C
SGD621C
SGD623M
SGD625M
SGD627C
SGD628M
SGD629M
SGD630M
SGD631C
SGD632M
SGD633M
SGD635C
SGD636C
SGD637C
SGD641M
SGD642M
SGD643C
SGD644M
SGD645M
SGD647M
SGD648M
SGD649M
SGD650M
SGD652M
SGD653C
SGD655M
SGD659M
SGD660M
SGD661C
SGD662M
SGD664M
SGD665C
SGD666C
SGD667M
SGD668C
SGD669C
SGD670M
SGD672C
SGD674M
SGD676M
SGD677C
SGD679M
SGD680C
SGD684M
SGD685C
SGD687M
SGD688M
SGD689M
SGD691C
SGD694M
SGD697C
SGD698C
SGD699M
SGD700M
SGD702M
SGD704M
SGD707C
SGD708M
SGD709M
SGD710M
SGD711M
SGD714M
SGD720M
SGD721C
SGD722C
SGD723C
SGD724C
SGD725M
SGD726C
SGD727C
SGD729C
SGD730M
SGD733C
SGD736M
SGD741C
SGD746M
SGD748M
SGD749M
SGD750C
SGD751M
SGD753M
SGD754M
SGD755C
SGD757M
SGD758M
SGD760M
SGD762M
SGD763M
SGD768M
SGD770C
SGD771C
SGD772C
SGD773C
SGD774M
SGD775C
SGD779M
SGD780M
SGD781M
SGD782M
SGD783M
SGD784C
SGD785C
SGD787C
SGD790M
SGD791M
SGD792C
SGD793C
SGD794M
SGD795M
SGD796M
SGD797M
SGD798C
SGD799C
SGD802M
SGD803M
SGD804C
SGD805M
SGD806C
SGD812C
SGD813C
SGD815C
SGD816C
SGD817C
SGD819M
SGD820M
SGD821M
SGD822C
SGD823C
SGD824M
SGD828C
SGD830M
SGD831C
SGD832C
SGD833M
SGD834C
SGD835C
SGD837M
SGD838M
SGD840M
SGD841M
SGD842M
SGD843M
SGD844M
SGD855C
SGD856M
SGD857M
SGD858M
SGD862C
SGD864C
SGD865C
SGD866C
SGD867C
SGD868C
SGD869M
SGD870C
SGD871C
SGD881C
SGD882C
SGD883C
SGD884C
SGD885C
SGD886M
SGD889C
SGD892C
SGD893C
SGD898M
SGD899M
SGD900C
SGD902M
SGD904C
SGD905C
SGD906C
SGD908C
SGD909C
SGD913C
SGD914C
SGD923C
SGD924C
SGD925C
SGD926M
SGD929C
SGD931M
SGD932C
SGD934M
SGD935M
SGD937M
SGD941C
SGD945M
SGD946M
SGD948C
SGD956C
SGD959C
SGD965M
SGD966M
SGD976M
ATD1000C
ATD1005C
ATD1006M
ATD1008C
ATD1010M
ATD1015C
ATD1019C
ATD1022C
ATD1028C
ATD1032M
ATD1033C
ATD1038C
ATD1039C
ATD1040C
ATD1041C
ATD1045M
ATD1046M
ATD1048C
ATD1056C
ATD1057C
ATD1058C
ATD1058P
ATD1064M
ATD1066M
ATD1067M
ATD1068M
ATD1069M
ATD1070C
ATD1073C
ATD1075C
ATD1080C
ATD1088C
ATD1089C
ATD1092C
ATD1093C
ATD1094C
ATD1100C
ATD1101C
ATD1105C
ATD1113C
ATD1114C
ATD1119C
ATD1120C
ATD1124C
ATD1136M
ATD1159C
ATD1159P
ATD1161C
ATD1164C
ATD1185M
ATD1192C
ATD1194C
ATD1222C
ATD433AC
ATD433BM
ATD436AC
ATD465AC
ATD580AC
ATD655AM
ATD667AC
ATD674AC
ATD674AM
ATD674AP
ATD702AM
ATD730AC
ATD731AC
ATD786AM
ATD855AC
ATD888AC
ATD906AC
ATD974AC
ATD974AP
PGD1000M
PGD1001M
PGD1002C
PGD1002M
PGD1003M
PGD1004C
PGD1005C
PGD1005M
PGD1007M
PGD1008C
PGD1008M
PGD1009M
PGD1010M
PGD1011M
PGD1012M
PGD1013M
PGD1014M
PGD1015C
PGD1016M
PGD1017M
PGD1018M
PGD1019M
PGD1020C
PGD1021C
PGD1021M
PGD1022C
PGD1022M
PGD1024M
PGD1028C
PGD1028M
PGD1030C
PGD1031C
PGD1033C
PGD1035C
PGD1036C
PGD1037C
PGD1038C
PGD1039C
PGD1040C
PGD1041C
PGD1042M
PGD1043C
PGD1044C
PGD1045M
PGD1046M
PGD1047C
PGD1048C
PGD1049M
PGD1050M
PGD1051C
PGD1053M
PGD1054M
PGD1055C
PGD1056C
PGD1057C
PGD1058C
PGD1059M
PGD1060M
PGD1061M
PGD1064M
PGD1065M
PGD1066M
PGD1067M
PGD1068M
PGD1069M
PGD1070C
PGD1071C
PGD1073C
PGD1074C
PGD1075C
PGD1077M
PGD1078C
PGD1080C
PGD1081C
PGD1082C
PGD1083M
PGD1084M
PGD1085M
PGD1086C
PGD1088C
PGD1089C
PGD1090C
PGD1091C
PGD1092C
PGD1093C
PGD1094C
PGD1095C
PGD1095M
PGD1097C
PGD1100C
PGD1101C
PGD1102C
PGD1103C
PGD1104C
PGD1105C
PGD1107C
PGD1107M
PGD1108C
PGD1108M
PGD1111M
PGD1112M
PGD1113C
PGD1114C
PGD1118M
PGD1119C
PGD1120C
PGD1121M
PGD1123M
PGD1124C
PGD1125C
PGD1130M
PGD1149M
PGD1156C
PGD1157C
PGD1158C
PGD1159C
PGD1160C
PGD1161C
PGD1164C
PGD1169C
PGD1170M
PGD1171M
PGD1172C
PGD1178M
PGD1179C
PGD1184C
PGD1188C
PGD1192C
PGD1194C
PGD1195C
PGD1202C
PGD1210C
PGD1211C
PGD1212C
PGD1222C
PGD1258C
PGD1259C
PGD145AM
PGD149QS
PGD154QS
PGD158AM
PGD227AM
PGD233AM
PGD242QS
PGD249QS
PGD269QS
PGD273QS
PGD280BM
PGD280CM
PGD280DM
PGD323AC
PGD325QS
PGD333QS
PGD334QS
PGD340AC
PGD340AM
PGD344AM
PGD349QS
PGD368QS
PGD369QS
PGD370QS
PGD374QS
PGD375QS
PGD376QS
PGD377QS
PGD383QS
PGD391QS
PGD394AM
PGD394QS
PGD396QS
PGD407AM
PGD408AM
PGD409QS
PGD412QS
PGD413QS
PGD419AM
PGD421AM
PGD421QS
PGD433AC
PGD436AC
PGD436AM
PGD459QS
PGD465AC
PGD465AM
PGD465QS
PGD466AM
PGD470QS
PGD471QS
PGD473QS
PGD476QS
PGD477QS
PGD484QS
PGD486QS
PGD491AM
PGD492QS
PGD493AM
PGD493QS
PGD499AM
PGD499AR
PGD502QS
PGD503QS
PGD505QS
PGD506QS
PGD507QS
PGD508QS
PGD518AM
PGD520AM
PGD522QS
PGD524QS
PGD526QS
PGD529AM
PGD530QS
PGD536QS
PGD537QS
PGD540QS
PGD542QS
PGD551QS
PGD555AM
PGD555BM
PGD558QS
PGD561AM
PGD562QS
PGD567QS
PGD576QS
PGD579QS
PGD580AC
PGD580QS
PGD587QS
PGD588QS
PGD591QS
PGD598QS
PGD600QS
PGD601QS
PGD610QS
PGD611QS
PGD613QS
PGD614AM
PGD617QS
PGD618QS
PGD619QS
PGD623QS
PGD627QS
PGD632QS
PGD637QS
PGD638AM
PGD640QS
PGD642QS
PGD643QS
PGD648QS
PGD650QS
PGD652QS
PGD653AC
PGD653AM
PGD653QS
PGD655AM
PGD659QS
PGD665QS
PGD666QS
PGD667AM
PGD667QS
PGD668QS
PGD672QS
PGD674AM
PGD674QS
PGD679QS
PGD684AM
PGD687AM
PGD688AM
PGD691QS
PGD697QS
PGD698QS
PGD699QS
PGD702AM
PGD702QS
PGD707QS
PGD709AC
PGD709AM
PGD709QS
PGD711QS
PGD714QS
PGD720QS
PGD721QS
PGD722QS
PGD723QS
PGD726QS
PGD727QS
PGD729QS
PGD730AC
PGD730AM
PGD730QS
PGD731QS
PGD732AM
PGD732QS
PGD737QS
PGD741QS
PGD746QS
PGD748QS
PGD749QS
PGD750QS
PGD753QS
PGD754QS
PGD755QS
PGD757QS
PGD758QS
PGD760QS
PGD762AM
PGD768AM
PGD768QS
PGD771QS
PGD774QS
PGD784AC
PGD784AM
PGD784QS
PGD785QS
PGD786AM
PGD787QS
PGD790QS
PGD791QS
PGD792QS
PGD793QS
PGD798QS
PGD799QS
PGD803QS
PGD804QS
PGD805QS
PGD806QS
PGD812QS
PGD815AC
PGD815AM
PGD815QS
PGD816QS
PGD817QS
PGD820QS
PGD822QS
PGD823QS
PGD824QS
PGD828QS
PGD829QS
PGD830QS
PGD833AM
PGD833QS
PGD834QS
PGD835QS
PGD839AM
PGD840AM
PGD841QS
PGD843QS
PGD853AM
PGD855AC
PGD855QS
PGD856AC
PGD856AM
PGD856QS
PGD862QS
PGD864AC
PGD864AM
PGD865QS
PGD866QS
PGD867QS
PGD868QS
PGD881QS
PGD882QS
PGD883QS
PGD884QS
PGD888AC
PGD899AM
PGD905QS
PGD906AC
PGD908QS
PGD909QS
PGD913QS
PGD914QS
PGD921QS
PGD922QS
PGD923QS
PGD924QS
PGD931QS
PGD932QS
PGD934QS
PGD935QS
PGD943QS
PGD946AM
PGD959QS
PGD966AM
PGD969QS
PGD974AC
PGD974AM
PGD974QS
PGD976QS
PGD981QS
PGD999QS
SGD1013C
SGD1028C
SGD1030C
SGD1031C
SGD1033C
SGD1035C
SGD1036C
SGD1039C
SGD1044C
SGD1047C
SGD1074C
SGD145AM
SGD158AM
SGD227AM
SGD233AM
SGD280BM
SGD280DM
SGD323AC
SGD340AM
SGD344AM
SGD421AM
SGD433AC
SGD436AC
SGD465AC
SGD466AM
SGD499AM
SGD518AM
SGD520AM
SGD529AM
SGD555AM
SGD580AC
SGD614AM
SGD655AM
SGD667AM
SGD674AM
SGD687AM
SGD688AM
SGD702AM
SGD709AM
SGD730AM
SGD762AM
SGD768AM
SGD815AC
SGD856AC
SGD864AC
SGD906AC
ATD1019AC
ATD1040AC
ATD1040AP
ATD1057AP
ATD1185AM
PGD1000QS
PGD1005QS
PGD1008QS
PGD1009QS
PGD1013QS
PGD1015QS
PGD1019AM
PGD1019QS
PGD1020AM
PGD1020QS
PGD1021QS
PGD1022QS
PGD1028QS
PGD1033QS
PGD1038QS
PGD1039QS
PGD1040AC
PGD1040QS
PGD1041QS
PGD1043QS
PGD1047QS
PGD1048QS
PGD1051QS
PGD1055QS
PGD1056QS
PGD1057AM
PGD1057QS
PGD1058QS
PGD1070QS
PGD1073QS
PGD1075QS
PGD1078QS
PGD1080QS
PGD1081QS
PGD1082QS
PGD1086QS
PGD1088QS
PGD1089QS
PGD1090QS
PGD1091QS
PGD1092QS
PGD1093QS
PGD1094QS
PGD1100QS
PGD1101QS
PGD1102QS
PGD1103QS
PGD1105QS
PGD1113QS
PGD1114QS
PGD1119QS
PGD1120QS
PGD1124QS
PGD1158QS
PGD1159QS
PGD1161QS
PGD1164QS
PGD1169QS
PGD1172QS
PGD1194QS
PGD421AQS
PGD433AQS
PGD436AQS
PGD465AQS
PGD580AQS
PGD653AQS
PGD667AQS
PGD674AQS
PGD730AQS
PGD731AQS
PGD784AQS
PGD815AQS
PGD855AQS
PGD856AQS
PGD906AQS
PGD974AQS
PGD1019AQS
PGD1040AQS
I am looking for a way to sort our numeric numbers based on length and
then
sort our Alpha/numeric parts up the hyphen in the part number
okay, hopefully i understood your goal better this time. paste the following
SQL statement into a new query's SQL pane, as
SELECT IIf(Asc(Left([Comp Part],1))<58,0,Len(IIf(InStr(1,[Comp
Part],"-")=0,[Comp Part],Left([Comp Part],InStr(1,[x],"-")-1)))) AS SortA,
IIf(Asc(Left([Comp Part],1))<65,CLng([Comp Part]),0) AS SortB, Table13.[Comp
Part]
FROM Table13
ORDER BY IIf(Asc(Left([Comp Part],1))<58,0,Len(IIf(InStr(1,[Comp
Part],"-")=0,[x],Left([Comp Part],InStr(1,[Comp Part],"-")-1)))),
IIf(Asc(Left([Comp Part],1))<65,CLng([Comp Part]),0), Table13.[Comp Part];
remember to replace Table13 with the correct table name, of course. if the
sort order fits your needs, then include the two calculated fields in the
"real" query that the report is based on. in the *report*, sort the data by
fields SortA, SortB, and [Comp Part], in that order. (note: don't bother
sorting the fields at the query level at all, it's the report level sort
that will "stick".)
hth
Thanks for the reply.
The sort I want is numeric first based on the number of places, i.e. 2
digits in order, then 3 digits in order, then 4 digits in order, etc all
the way to 6 digits in order, each group in numberical order, not computer
order.
Then, the sort should deal with strings that begin with Alphas. Sort on
the Alpha letters first and then the numbers following the alpha, i.e.
Alpha 2-digit, then Alpha 3 digit, then Alpha 4 digit, etc up to Alpha 6
digits. What I am after is very close to the example I offered although I
think I got some out of actual order. Some of the Alpha 5 digit have a
hyphen number, i.e. H15664-2 that need to sort with the Alpha 5 digit.
Also, I was planning to put the sorting formula in a Report, probably in
the Sorting and Grouping area. BTW, the Field I want to sort is named
"Comp Part" if that helps!
Thanks
I am looking for a way to sort our numeric numbers based on length and
then
sort our Alpha/numeric parts up the hyphen in the part number
i took the list of values you posted and dumped them into a single-field
table, then created a query on that table, as
SELECT Table13.x,
IIf(InStr(1,[x],"-")=0,[x],Left([x],InStr(1,[x],"-")-1))
AS SortBy
FROM Table13;
the [x] field is the values, the SortBy field is a calculated field that
returns the [x] value when there's no hyphen, and the [x] value up to the
hyphen on all others. but what i'm seeing is that sorting by the SortBy
field returns the same order as sorting by the [x] field, so there's no
need
to "get rid of" the hyphenated suffix before sorting.
can you post an example of how you *want* the previously posted list to
be
sorted?
hth
Yes, we sort our numbers before our alpha numbers, but we do it based
on
length within those groups, i.e.
1234
12345
123456
ABS12345
ABS123456
ATD123
ATD123C
ATD123M
ATD1234
ATD1234C
ATD1234M
BC1234
BC12345
BC123456
BH1234
BH12345
BH123456
CMA12345
CMA123456
H12
H12-2
H123
H123K
H123W
H123-2
H1234
H1234-2
H1234K
H1234W
H12345
H12345-2
H12345K
H12345W
MC1234
MC12345
MC123456
PGD123
PGD123C
PGD123M
PGD1234C
PGD1234M
SC12345
SC123456
SGD123
SGD123C
SGD123M
SGD1234
SGD1234C
SGD1234M
WC1234
WC12345
WC123456
There are more Alpha prefixes, but if I can sort this sample, the rest
will
fall into place as well.
Thanks!
On Sun, 24 Jun 2007 06:29:54 -0700, "Jeff Boyce"
Tom
Without an example to help "see" what you're doing, this is only a
guess...
It sounds like you want to sort your "part numbers" in alphabetic
order.
If
any of the part numbers start with numbers, those should sort before
the
alpha-beginning numbers.