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

Multiple Sort Criteria

Status
Not open for further replies.

FrankMars

Technical User
Dec 20, 2010
67
US

I have a continuous form (Form 1) which is sorted by a combo box on a second form (Form 2). I have written the following code on the open event of Form 1 which works fine;

Me.OrderByOn = True
Me.OrderBy = Forms!zzfbCriteriaSortBy![cbxSortBy]


I would like to add a secondary sort. I have added a second combo box on Form 2 and changed the code on the open event of Form 1 to the following which DOES NOT WORK;

Me.OrderByOn = True
Me.OrderBy = Forms!zzfbCriteriaSortBy![cbxSortBy],Forms!zzfbCriteriaSortBy![cbxSortBy2]

I've also tried;
Me.OrderByOn = True
Me.OrderBy = "Forms!zzfbCriteriaSortBy![cbxSortBy],Forms!zzfbCriteriaSortBy![cbxSortBy2]"

I've also tried;
Me.OrderByOn = True
Me.OrderBy = "[Forms]![zzfbCriteriaSortBy]![cbxSortBy],[Forms]![zzfbCriteriaSortBy]![cbxSortBy2]"

Is it possible to have multiple sorts? What am I doing wrong?

Thank you in advance.




 
I would try:
Code:
Me.OrderByOn = True
Me.OrderBy = Forms!zzfbCriteriaSortBy![cbxSortBy] & "," & Forms!zzfbCriteriaSortBy![cbxSortBy2]
I'm not sure how/if this would work if you have spaces in your field names.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top