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!

Help needed with custom sort order query

Status
Not open for further replies.

dceglar2

Technical User
Feb 23, 2005
7
US
Field: Expr1:Switch([GRADE]="PK*","a",[GRADE]="KG","a",[GRADE]="01","a",[GRADE]="02","a",[GRADE]="03","a",[GRADE]="04","a",[GRADE]="05","b",[GRADE]="06","b",[GRADE]="07","b",[GRADE]="08","c",[GRADE]="09","c",[GRADE]="10","c",[GRADE]="11","c")

Table: Table Name

Sort: Ascending

The above is returning "Syntax error (comma) in query expression. I have looked and looked at it and it seems to be setup just like the sample in Microsoft Q304564 write up.

My goal is to sort by grade - and group them according to the campus that the students will be at next year. (a is preK 3 or PreK 4, Kinder, and 1-5 grades; b is jr. high, etc.) Please advise!
 
[GRADE]="PK*" probably won't ever match, but even so it worked for me with no syntax errors. Can you post the entire SQL?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
That is all I have - I am creating a query with all the fields used in my report and then adding this info to new a column.
 
Try using your expression with a smaller set to see what you get. e.g.
Code:
Expr1: Switch([GRADE]="01","a",[GRADE]="05","b",[GRADE]="11","c")
 
Yes,I have a field named [GRADE] and I only have one table in my database.
 
Try a new simple query with just two fields. [GRADE] and Expr1 - no sort - nothing fancy - does that work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top