PDA

Click to See Complete Forum and Search --> : 'Sort order cannot be applied' error


gwa584
Aug 28th, 2000, 11:56 AM
Anyone know why a sort cannot be applied to a
column of a recordset that is of type "adBSTR"?

All I get with the following line is, "Sort order
cannot be applied." there are three rows of data
in the recordset already and each has a value for
all columns including this "FavColor" column.


rs.Sort = "FavColor"

gwa584
Aug 28th, 2000, 12:08 PM
Ok, i've fixed my problem, but for anyone else who tries
to do the same thing, be sure to use "adVarChar" or the
like because sorting a adBSTR doesn't seem to work.

Also, in order to append a new column as a type "adVarChar"
(or similar type), be SURE to specify a size or it will
give you errors as well...even though it doesn't tell you
that that's a required parameter.

Thus use something like:

With rs
.Fields.Append "FName", adVarChar, 20 '<-- the size is
.Fields.Append "BirthDate", adDate ' critical
.Fields.Append "FavColor", adVarChar, 20
End With

'Instead of:

With rs
.Fields.Append "FName", adBSTR
.Fields.Append "BirthDate", adDate
.Fields.Append "FavColor", adBSTR
End With