To enable sorting, the cursor location must be adUseClient.
Even when specifying the recordset cursor location to
adUseClient, you may still have a problem as you are using
the CurrentProject connection object (as its CursorLocation
is adUseServer). If so, you will have to declare a
connection object, set it to CurrentProject.Connection,
then change its CursorLocation to adUseClient.
Hope This Helps
Gerald Stanley MCSD
>-----Original Message-----
>I have the following sample code which returns a run-time
error 3251.
>
>Private Sub btnMain_Click()
> Dim rst1 As Recordset
>
> Set rst1 = New ADODB.Recordset
> rst1.CursorType = adOpenKeyset
> rst1.LockType = adLockOptimistic
> rst1.CursorLocation = adUseServer
>
> rst1.Open "tblMain", CurrentProject.Connection
> rst1.Sort = "KEY ASC"
>
> rst1.Close
> Set rst1 = Nothing
>End Sub
>
>The problem is with the Sort Property applied to the
recordset object.
>
>Any help greatly appreicated.
>
>Thanks heaps
>
>Greg
>.
>
|