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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO recordset sorting

Status
Not open for further replies.

formerTexan

Programmer
Apr 10, 2004
504
US
Hi All,

The use of rs.Sort in the following code block returns an error "invalid use of property". So I will first ask "what am I doing wrong with my ADO recordset"?

My intention is to coordinate the recordsets of two subforms with the parent form. None of the forms will be editable. Providing I clear the sort hurdle for the parent form, will I run into any further difficulties keeping the subform recordsets similarly sorted?

Thanks,
Bill


Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = CurrentProject.Connection
Set rs = New ADODB.Recordset

With rs
.Source = "qryReservation"
.ActiveConnection = cnn
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.LockType = adLockReadOnly
.Open Options:=adCmdStoredProc

End With

' ** "INVALID USE OF PROPERTY" ON THE FOLLOWING LINE
rs.Sort "Resno DESC"
Set Me.Recordset = rs
Set Forms("frmReservation")("child0").Form.Recordset = Me.Recordset
Set Forms("frmReservation")("child1").Form.Recordset = Me.Recordset
 
Try with an equal sign

[tt]rs.Sort = "Resno DESC"[/tt]

Roy-Vidar
 
Thank you Roy,

Yes, that was the answer. Unfortunately though, sorting the recordset seems to have no bearing on how records are ordered/displayed on the forms.

Any further suggestions? The goal of this was to use a disconnected recordset for sorting and filtering on a low overhead form.

Thanks again,
Bill
 
Howdy again,

Since there is more than one way to skin the poor cat, I shifted to sorting by using the form/subform's OrderBy property.

Me.OrderBy = strOrderBy

This pitched up error 2725 "The OLE server isn't registered".

Since the problem is specific to this particular application, I cant help thinking there is a connection to using a disconnected ADO recordset.

I'm just getting the whining out of my system, but anyone has a clue, I'd appreciate hearing about it.

Cheers,
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top