formerTexan
Programmer
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
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