I'm trying to create a custom order by that builds a statement based on the order of the array. I'm starting to think that SQL Case statement is not supported by MS Access. Or possibly there is a syntax error, on my part.
Here is the String building loop..
Then i set the query.SQL property to this string. And it gives error 3075 Syntax error (missing operator).
Here is the main sql statement.
CustomSort is a function, returns string.
If this method is not supported, is there a way to do this in access, without adding a separate identifying column?
I just really want a generic and quick way to do this.
Here is the String building loop..
Code:
strSQL = "Case [" & FieldName & "] "
For z = intFirst To intLast
strSQL = strSQL & _
"WHEN " & SortOrder(z) & _
" THEN " & forCount & " "
forCount = forCount + 1
Next z
strSQL = strSQL & "END;"
Here is the main sql statement.
Code:
sqlSort = "SELECT * FROM [table1] ORDER BY (" & _
CustomSort(Sorts(), FieldName) & ")"
If this method is not supported, is there a way to do this in access, without adding a separate identifying column?
I just really want a generic and quick way to do this.
Comment