Using the Right function

Using the Right function

am 30.11.2007 01:56:29 von Big Moxy

orderBy is a querystring value which contains 2 characters (e.g.
orderBy=a0). The first is an "a" or "d" representing the sort sequence
and the second is a one digit number corresponding to the array index
of a field names.

The problem is that I get a type mismatch (Type mismatch:
'Right(...)' ) on this statement:

If (Request.Querystring("orderBy").Count = 0) Then
sortOrder = "ASC"
sortField = "ID"
Else
If Left(orderBy,1) <> "d" Then
sortOrder = "ASC"
Else
sortOrder = "DESC"
End If
sortField = columns(Right(orderBy,1))
End If

How should I be using the Right function?

Thank you!

Re: Using the Right function

am 30.11.2007 05:00:50 von McKirahan

"Big Moxy" wrote in message
news:83328a01-c270-4342-be46-3cc6cea1c12f@e25g2000prg.google groups.com...
> orderBy is a querystring value which contains 2 characters (e.g.
> orderBy=a0). The first is an "a" or "d" representing the sort sequence
> and the second is a one digit number corresponding to the array index
> of a field names.
>
> The problem is that I get a type mismatch (Type mismatch:
> 'Right(...)' ) on this statement:
>
> If (Request.Querystring("orderBy").Count = 0) Then
> sortOrder = "ASC"
> sortField = "ID"
> Else
> If Left(orderBy,1) <> "d" Then
> sortOrder = "ASC"
> Else
> sortOrder = "DESC"
> End If
> sortField = columns(Right(orderBy,1))
> End If
>
> How should I be using the Right function?

Try

sortField = columns(CInt(Right(orderBy,1)))