B
Bula
I created a disconnected ado recordset when a form is open:
Private Sub Form_Open(Cancel As Integer)
Dim formrst As ADODB.Recordset
Set formrst = New ADODB.Recordset
'append 3 fields
With formrst
.ActiveConnection = Nothing
.CursorLocation = adUseClient
.Fields.Append "Fname", adBSTR
.Fields.Append "Lname", adBSTR
.Fields.Append "Age", adBigInt
End With
'append some values to the recordset
With formrst
.Open
.AddNew
.Fields("fname") = "Tom"
.Fields("lname") = "Cruse"
.Fields("Age") = 20
.UpdateBatch
.AddNew
.Fields("fname") = "John"
.Fields("Lname") = "Philly"
.Fields("Age") = 30
.UpdateBatch
End With
Set Me.Recordset = formrst
End Sub
When I open the form in datasheet view, all data are shown correctly.
However, when I click the Filter or Sort buttons on the command bar,
the application corrupts.
Could you please tell me how can I apply filter and sort to a form
with Adodb type recordset?
Your help is highly appreciated
Bula
Private Sub Form_Open(Cancel As Integer)
Dim formrst As ADODB.Recordset
Set formrst = New ADODB.Recordset
'append 3 fields
With formrst
.ActiveConnection = Nothing
.CursorLocation = adUseClient
.Fields.Append "Fname", adBSTR
.Fields.Append "Lname", adBSTR
.Fields.Append "Age", adBigInt
End With
'append some values to the recordset
With formrst
.Open
.AddNew
.Fields("fname") = "Tom"
.Fields("lname") = "Cruse"
.Fields("Age") = 20
.UpdateBatch
.AddNew
.Fields("fname") = "John"
.Fields("Lname") = "Philly"
.Fields("Age") = 30
.UpdateBatch
End With
Set Me.Recordset = formrst
End Sub
When I open the form in datasheet view, all data are shown correctly.
However, when I click the Filter or Sort buttons on the command bar,
the application corrupts.
Could you please tell me how can I apply filter and sort to a form
with Adodb type recordset?
Your help is highly appreciated
Bula